From 5ba390e4025b9f00705de36f3245df2079c8e95f Mon Sep 17 00:00:00 2001 From: leeheefull Date: Sun, 17 Nov 2024 23:21:17 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B7=B8=EB=A3=B9=20=ED=83=9C?= =?UTF-8?q?=EA=B7=B8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/extension/QuerydslExtension.kt | 2 +- .../domain/discussion/domain/Discussion.kt | 2 +- .../discussion/domain/DiscussionComment.kt | 2 +- .../domain/group/application/GroupFacade.kt | 12 +++---- .../group/application/GroupTagService.kt | 32 ++++++++++--------- .../alignlab/domain/group/domain/Group.kt | 2 +- .../alignlab/domain/group/domain/GroupTag.kt | 2 +- .../domain/group/domain/GroupTagMap.kt | 2 +- .../alignlab/domain/group/domain/GroupUser.kt | 2 +- .../domain/group/domain/GroupUserScore.kt | 2 +- .../infrastructure/GroupQRepositoryImpl.kt | 9 ++---- .../infrastructure/GroupTagMapRepository.kt | 5 +-- .../infrastructure/GroupTagQRepository.kt | 7 ++++ .../infrastructure/GroupTagQRepositoryImpl.kt | 17 ++++++++++ .../infrastructure/GroupTagRepository.kt | 8 ++--- .../group/model/response/GetGroupResponse.kt | 4 +-- .../domain/group/resource/GroupResource.kt | 2 -- .../domain/image/domain/ImageMetadata.kt | 4 +-- .../domain/log/domain/SystemActionLog.kt | 2 +- .../notification/domain/PoseNotification.kt | 4 +-- .../alignlab/domain/pose/domain/PoseCount.kt | 2 +- .../pose/domain/PoseKeyPointSnapshot.kt | 2 +- .../alignlab/domain/pose/domain/PoseLayout.kt | 2 +- .../domain/pose/domain/PoseLayoutPoint.kt | 2 +- .../domain/pose/domain/PoseSnapshot.kt | 2 +- .../domain/user/domain/CredentialUserInfo.kt | 2 +- .../domain/user/domain/OAuthUserInfo.kt | 2 +- .../alignlab/domain/user/domain/UserInfo.kt | 2 +- 28 files changed, 80 insertions(+), 58 deletions(-) create mode 100644 src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepository.kt create mode 100644 src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepositoryImpl.kt diff --git a/src/main/kotlin/com/hero/alignlab/common/extension/QuerydslExtension.kt b/src/main/kotlin/com/hero/alignlab/common/extension/QuerydslExtension.kt index a16a55f..c77df6a 100644 --- a/src/main/kotlin/com/hero/alignlab/common/extension/QuerydslExtension.kt +++ b/src/main/kotlin/com/hero/alignlab/common/extension/QuerydslExtension.kt @@ -44,7 +44,7 @@ fun NumberPath.isEquals(parameter: Long?): BooleanExpression? { } fun StringPath.isContains(parameter: String?): BooleanExpression? { - return parameter?.let { param -> this.contains(param) } + return parameter?.takeIf { param -> param.isNotEmpty() }?.let { param -> this.contains(param) } } fun NumberPath.isIn(parameters: Set?): BooleanExpression? { diff --git a/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt b/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt index a9fe16a..3b359f8 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/Discussion.kt @@ -9,7 +9,7 @@ import jakarta.persistence.* class Discussion( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1L, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/DiscussionComment.kt b/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/DiscussionComment.kt index b2d7c92..a613b8d 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/DiscussionComment.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/discussion/domain/DiscussionComment.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* class DiscussionComment( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1L, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupFacade.kt b/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupFacade.kt index b373325..166a8f7 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupFacade.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupFacade.kt @@ -90,7 +90,7 @@ class GroupFacade( val updatedGroupTag = if (!request.tagNames.isNullOrEmpty()) { groupTagService.validateGroupTag(request.tagNames) - groupTagService.deleteSyncGroupId(groupId) + groupTagService.deleteGroupTagMapSyncByGroupId(groupId) groupTagService.saveSync(CreateGroupTagRequest(groupId, request.tagNames)) } else emptyList() @@ -118,7 +118,7 @@ class GroupFacade( txTemplates.writer.executes { groupUserScoreService.deleteAllByUid(uid) - groupTagService.deleteSyncGroupId(groupId) + groupTagService.deleteGroupTagMapSyncByGroupId(groupId) } } @@ -214,12 +214,12 @@ class GroupFacade( .filterNot { groupUserScore -> groupUserScore.score == null } .sortedBy { groupUserScore -> groupUserScore.score } .take(5) - } - ) { group, groupUserScore -> + }, + { groupTagService.findByGroupId(groupId) }, + ) { group, groupUserScore, tags -> val ownerGroupUser = userInfoService.getUserByIdOrThrow(group.ownerUid) - val tags = groupTagService.findByGroupId(groupId) - GetGroupResponse.from(group, ownerGroupUser.nickname, tags).run { + GetGroupResponse.of(group, tags, ownerGroupUser.nickname).run { when (group.ownerUid == user.uid) { true -> this false -> this.copy(joinCode = null) diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupTagService.kt b/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupTagService.kt index 06a1da1..0b55bef 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupTagService.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/application/GroupTagService.kt @@ -19,31 +19,33 @@ class GroupTagService( ) { @Transactional fun saveSync(request: CreateGroupTagRequest): List { - return request.tagNames.map { tagName -> - findOrCreateTag(tagName).also { tag -> - groupTagMapRepository.save(GroupTagMap(groupId = request.groupId, tagId = tag.id)) - } - } + val existsTags = groupTagRepository.findAllByNameIn(request.tagNames) + val existsTagNames = existsTags.map { tag -> tag.name } + + val needToCreateTags = request.tagNames + .filterNot { tagName -> existsTagNames.contains(tagName) } + .map { tagName -> GroupTag(name = tagName) } + + val createdTags = groupTagRepository.saveAll(needToCreateTags) + + (createdTags + existsTags) + .map { tag -> GroupTagMap(groupId = request.groupId, tagId = tag.id) } + .run { groupTagMapRepository.saveAll(this) } + + return (createdTags + existsTags) } @Transactional - fun deleteSyncGroupId(groupId: Long) { - groupTagMapRepository.deleteByGroupId(groupId) + fun deleteGroupTagMapSyncByGroupId(groupId: Long) { + groupTagMapRepository.deleteAllByGroupId(groupId) } suspend fun findByGroupId(groupId: Long): List { return withContext(Dispatchers.IO) { - val tagIds = groupTagMapRepository.findByGroupId(groupId) - .map { it.tagId } - groupTagRepository.findByIdIn(tagIds) + groupTagRepository.findByGroupId(groupId) } } - private fun findOrCreateTag(tagName: String): GroupTag { - return groupTagRepository.findByName(tagName) - .firstOrNull() ?: groupTagRepository.save(GroupTag(name = tagName)) - } - fun validateGroupTag(tagNames: List) { if (tagNames.size > 3) { throw InvalidRequestException(ErrorCode.OVER_COUNT_GROUP_TAG_ERROR) diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/domain/Group.kt b/src/main/kotlin/com/hero/alignlab/domain/group/domain/Group.kt index c91e428..fa34c6d 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/domain/Group.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/domain/Group.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* data class Group( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "name") var name: String, diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTag.kt b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTag.kt index 85fc777..90e9d23 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTag.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTag.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* data class GroupTag( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "name") var name: String, diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTagMap.kt b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTagMap.kt index 55bf409..33ef049 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTagMap.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupTagMap.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* data class GroupTagMap ( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "group_id") val groupId: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUser.kt b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUser.kt index 0203f95..ac64adb 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUser.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUser.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* data class GroupUser( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "group_id") val groupId: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUserScore.kt b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUserScore.kt index 074d82d..04dc288 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUserScore.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/domain/GroupUserScore.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* class GroupUserScore( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "group_id") val groupId: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupQRepositoryImpl.kt b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupQRepositoryImpl.kt index 883d4fc..16f0449 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupQRepositoryImpl.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupQRepositoryImpl.kt @@ -1,5 +1,6 @@ package com.hero.alignlab.domain.group.infrastructure +import com.hero.alignlab.common.extension.isContains import com.hero.alignlab.domain.group.domain.Group import com.hero.alignlab.domain.group.domain.QGroup.group import com.hero.alignlab.domain.group.domain.QGroupTag.groupTag @@ -20,9 +21,7 @@ class GroupQRepositoryImpl( .from(group) .leftJoin(groupTagMap).on(group.id.eq(groupTagMap.groupId)) .leftJoin(groupTag).on(groupTagMap.tagId.eq(groupTag.id)) - .where( - tagName?.takeIf { it.isNotEmpty() }?.let { groupTag.name.contains(it) } - ) + .where(groupTag.name.isContains(tagName)) .offset(pageable.offset) .limit(pageable.pageSize.toLong()) .orderBy(getGroupOrderSpecifier(pageable)) @@ -33,9 +32,7 @@ class GroupQRepositoryImpl( .from(group) .leftJoin(groupTagMap).on(group.id.eq(groupTagMap.groupId)) .leftJoin(groupTag).on(groupTagMap.tagId.eq(groupTag.id)) - .where( - tagName?.takeIf { it.isNotEmpty() }?.let { groupTag.name.contains(it) } - ) + .where(groupTag.name.isContains(tagName)) .orderBy(getGroupOrderSpecifier(pageable)) .fetchOne() ?: 0L diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagMapRepository.kt b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagMapRepository.kt index 12fdf91..8776059 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagMapRepository.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagMapRepository.kt @@ -3,9 +3,10 @@ package com.hero.alignlab.domain.group.infrastructure import com.hero.alignlab.domain.group.domain.GroupTagMap import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository +import org.springframework.transaction.annotation.Transactional +@Transactional(readOnly = true) @Repository interface GroupTagMapRepository : JpaRepository { - fun findByGroupId(groupId: Long): MutableList - fun deleteByGroupId(groupId: Long) + fun deleteAllByGroupId(groupId: Long) } \ No newline at end of file diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepository.kt b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepository.kt new file mode 100644 index 0000000..3a0b284 --- /dev/null +++ b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepository.kt @@ -0,0 +1,7 @@ +package com.hero.alignlab.domain.group.infrastructure + +import com.hero.alignlab.domain.group.domain.GroupTag + +interface GroupTagQRepository { + fun findByGroupId(groupId: Long): List +} \ No newline at end of file diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepositoryImpl.kt b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepositoryImpl.kt new file mode 100644 index 0000000..d912915 --- /dev/null +++ b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagQRepositoryImpl.kt @@ -0,0 +1,17 @@ +package com.hero.alignlab.domain.group.infrastructure + +import com.hero.alignlab.domain.group.domain.GroupTag +import com.hero.alignlab.domain.group.domain.QGroupTag.groupTag +import com.hero.alignlab.domain.group.domain.QGroupTagMap.groupTagMap +import com.querydsl.jpa.impl.JPAQueryFactory + +class GroupTagQRepositoryImpl( + private val queryFactory: JPAQueryFactory, +) : GroupTagQRepository { + override fun findByGroupId(groupId: Long): List { + return queryFactory.selectFrom(groupTag) + .join(groupTagMap).on(groupTag.id.eq(groupTagMap.tagId)) + .where(groupTagMap.groupId.eq(groupId)) + .fetch() + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagRepository.kt b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagRepository.kt index 216a344..bd72a84 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagRepository.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/infrastructure/GroupTagRepository.kt @@ -3,10 +3,10 @@ package com.hero.alignlab.domain.group.infrastructure import com.hero.alignlab.domain.group.domain.GroupTag import org.springframework.data.jpa.repository.JpaRepository import org.springframework.stereotype.Repository +import org.springframework.transaction.annotation.Transactional +@Transactional(readOnly = true) @Repository -interface GroupTagRepository : JpaRepository { - fun findByName(name: String): List - - fun findByIdIn(ids: List): List +interface GroupTagRepository : JpaRepository, GroupTagQRepository { + fun findAllByNameIn(names: List): Set } \ No newline at end of file diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/model/response/GetGroupResponse.kt b/src/main/kotlin/com/hero/alignlab/domain/group/model/response/GetGroupResponse.kt index 48931d4..b3d44bc 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/model/response/GetGroupResponse.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/model/response/GetGroupResponse.kt @@ -22,7 +22,7 @@ data class GetGroupResponse( val tags: List?, ) { companion object { - fun from(group: Group, ownerName: String, tags: List): GetGroupResponse { + fun of(group: Group, tags: List?, ownerName: String): GetGroupResponse { return GetGroupResponse( id = group.id, name = group.name, @@ -33,7 +33,7 @@ data class GetGroupResponse( joinCode = group.joinCode, userCount = group.userCount, userCapacity = group.userCapacity, - tags = tags.map { GroupTagResponse(it.id, it.name) }, + tags = tags?.map { GroupTagResponse(it.id, it.name) }, ) } } diff --git a/src/main/kotlin/com/hero/alignlab/domain/group/resource/GroupResource.kt b/src/main/kotlin/com/hero/alignlab/domain/group/resource/GroupResource.kt index 1c9c1ee..3411d28 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/group/resource/GroupResource.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/group/resource/GroupResource.kt @@ -9,7 +9,6 @@ import com.hero.alignlab.common.model.PageResponse import com.hero.alignlab.common.model.Response import com.hero.alignlab.domain.auth.model.AuthUser import com.hero.alignlab.domain.group.application.GroupFacade -import com.hero.alignlab.domain.group.application.GroupService import com.hero.alignlab.domain.group.model.request.CheckGroupRegisterRequest import com.hero.alignlab.domain.group.model.request.CreateGroupRequest import com.hero.alignlab.domain.group.model.request.UpdateGroupRequest @@ -25,7 +24,6 @@ import org.springframework.web.bind.annotation.* @RestController @RequestMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) class GroupResource( - private val groupService: GroupService, private val groupFacade: GroupFacade, ) { /** diff --git a/src/main/kotlin/com/hero/alignlab/domain/image/domain/ImageMetadata.kt b/src/main/kotlin/com/hero/alignlab/domain/image/domain/ImageMetadata.kt index 339f03a..b8515ed 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/image/domain/ImageMetadata.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/image/domain/ImageMetadata.kt @@ -9,10 +9,10 @@ import jakarta.persistence.* class ImageMetadata( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") - val uid: Long = -1, + val uid: Long = 0L, @Column(name = "filename") val filename: String, diff --git a/src/main/kotlin/com/hero/alignlab/domain/log/domain/SystemActionLog.kt b/src/main/kotlin/com/hero/alignlab/domain/log/domain/SystemActionLog.kt index 5443676..e185e3e 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/log/domain/SystemActionLog.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/log/domain/SystemActionLog.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* class SystemActionLog( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1L, + val id: Long = 0L, @Column(name = "uid") val uid: Long? = null, diff --git a/src/main/kotlin/com/hero/alignlab/domain/notification/domain/PoseNotification.kt b/src/main/kotlin/com/hero/alignlab/domain/notification/domain/PoseNotification.kt index 7b2727f..fd6bd46 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/notification/domain/PoseNotification.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/notification/domain/PoseNotification.kt @@ -10,10 +10,10 @@ import jakarta.persistence.* class PoseNotification( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") - val uid: Long = -1, + val uid: Long = 0L, @Column(name = "is_active") var isActive: Boolean = true, diff --git a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseCount.kt b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseCount.kt index dd6e448..83683f5 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseCount.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseCount.kt @@ -11,7 +11,7 @@ class PoseCount( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseKeyPointSnapshot.kt b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseKeyPointSnapshot.kt index 9c5a393..720645b 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseKeyPointSnapshot.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseKeyPointSnapshot.kt @@ -10,7 +10,7 @@ class PoseKeyPointSnapshot( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - val id: Long = -1L, + val id: Long = 0L, @Column(name = "pose_snapshot_id") val poseSnapshotId: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayout.kt b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayout.kt index 12142f7..7e6d777 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayout.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayout.kt @@ -9,7 +9,7 @@ class PoseLayout( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayoutPoint.kt b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayoutPoint.kt index 0b68bea..f917d71 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayoutPoint.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseLayoutPoint.kt @@ -10,7 +10,7 @@ class PoseLayoutPoint( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - val id: Long = -1, + val id: Long = 0L, @Column(name = "pose_layout_id") val poseLayoutId: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseSnapshot.kt b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseSnapshot.kt index b5b3f01..1b3dcb4 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseSnapshot.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/pose/domain/PoseSnapshot.kt @@ -11,7 +11,7 @@ data class PoseSnapshot( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/user/domain/CredentialUserInfo.kt b/src/main/kotlin/com/hero/alignlab/domain/user/domain/CredentialUserInfo.kt index 7d54218..0ee7984 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/user/domain/CredentialUserInfo.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/user/domain/CredentialUserInfo.kt @@ -10,7 +10,7 @@ import jakarta.persistence.* class CredentialUserInfo( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/user/domain/OAuthUserInfo.kt b/src/main/kotlin/com/hero/alignlab/domain/user/domain/OAuthUserInfo.kt index 9417a88..bb246cc 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/user/domain/OAuthUserInfo.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/user/domain/OAuthUserInfo.kt @@ -9,7 +9,7 @@ import jakarta.persistence.* class OAuthUserInfo( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "uid") val uid: Long, diff --git a/src/main/kotlin/com/hero/alignlab/domain/user/domain/UserInfo.kt b/src/main/kotlin/com/hero/alignlab/domain/user/domain/UserInfo.kt index b31e92c..b18b0e4 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/user/domain/UserInfo.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/user/domain/UserInfo.kt @@ -8,7 +8,7 @@ import jakarta.persistence.* class UserInfo( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - val id: Long = -1, + val id: Long = 0L, @Column(name = "nickname") var nickname: String,