Skip to content

Commit

Permalink
fix: modify jpa enum converting
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Aug 30, 2024
1 parent 1b43098 commit d7c8f5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Discussion(
val uid: Long,

@Column(name = "type")
@Enumerated(EnumType.STRING)
val type: DiscussionType,

@Column(name = "title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ data class PoseSnapshot(
val score: BigDecimal,

@Column(name = "type")
@Enumerated(EnumType.STRING)
val type: PoseType,

@Column(name = "image_url")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface PoseSnapshotQRepository {
fun countByUidsAndDate(uids: List<Long>, date: LocalDate): List<PoseTypeCountModel>
}

class PoseSnapshotRepositoryImpl : PoseSnapshotQRepository, QuerydslRepositorySupport(PoseSnapshot::class.java) {
class PoseSnapshotQRepositoryImpl : PoseSnapshotQRepository, QuerydslRepositorySupport(PoseSnapshot::class.java) {
@Autowired
@Qualifier("heroEntityManager")
override fun setEntityManager(entityManager: EntityManager) {
Expand All @@ -46,12 +46,12 @@ class PoseSnapshotRepositoryImpl : PoseSnapshotQRepository, QuerydslRepositorySu
)
.from(qPoseSnapshot)
.where(
qPoseSnapshot.uid.`in`(uids)
.and(qPoseSnapshot.createdAt.year().eq(date.year))
.and(qPoseSnapshot.createdAt.month().eq(date.monthValue))
.and(qPoseSnapshot.createdAt.dayOfMonth().eq(date.dayOfMonth))
qPoseSnapshot.uid.`in`(uids),
qPoseSnapshot.createdAt.year().eq(date.year),
qPoseSnapshot.createdAt.month().eq(date.monthValue),
qPoseSnapshot.createdAt.dayOfMonth().eq(date.dayOfMonth)
)
.groupBy(qPoseSnapshot.type)
.groupBy(qPoseSnapshot.uid, qPoseSnapshot.type)
.fetch()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.hero.alignlab.domain.user.infrastructure

import com.hero.alignlab.common.encrypt.EncryptData
import com.hero.alignlab.domain.user.domain.*
import com.hero.alignlab.domain.user.domain.QCredentialUserInfo
import com.hero.alignlab.domain.user.domain.QOAuthUserInfo
import com.hero.alignlab.domain.user.domain.QUserInfo
import com.hero.alignlab.domain.user.domain.UserInfo
import com.hero.alignlab.domain.user.domain.vo.OAuthProvider
import com.querydsl.jpa.impl.JPAQuery
import jakarta.persistence.EntityManager
Expand Down Expand Up @@ -40,8 +43,7 @@ class UserInfoQRepositoryImpl : UserInfoQRepository, QuerydslRepositorySupport(U
private val qOAuthUserInfo = QOAuthUserInfo.oAuthUserInfo

override fun findByCredential(username: String, password: EncryptData): UserInfo? {
QOAuthUserInfo.oAuthUserInfo
return JPAQuery<UserInfo>(entityManager)
return JPAQuery<QUserInfo>(entityManager)
.select(qUserInfo)
.from(qUserInfo)
.join(qCredentialUserInfo).on(qUserInfo.id.eq(qCredentialUserInfo.uid))
Expand All @@ -52,7 +54,7 @@ class UserInfoQRepositoryImpl : UserInfoQRepository, QuerydslRepositorySupport(U
}

override fun findByOAuth(provider: OAuthProvider, oauthId: String): UserInfo? {
return JPAQuery<UserInfo>(entityManager)
return JPAQuery<QUserInfo>(entityManager)
.select(qUserInfo)
.from(qUserInfo)
.join(qOAuthUserInfo).on(qUserInfo.id.eq(qOAuthUserInfo.uid))
Expand All @@ -63,7 +65,7 @@ class UserInfoQRepositoryImpl : UserInfoQRepository, QuerydslRepositorySupport(U
}

override fun findAllUids(): List<Long> {
return JPAQuery<UserInfo>(entityManager)
return JPAQuery<QUserInfo>(entityManager)
.select(qUserInfo.id)
.from(qUserInfo)
.fetch()
Expand Down

0 comments on commit d7c8f5a

Please sign in to comment.