From 46803f40b56eed01f94c316e7a134e329e86bbee Mon Sep 17 00:00:00 2001 From: Klaus Date: Thu, 10 Sep 2026 15:10:27 +0900 Subject: [PATCH] =?UTF-8?q?feat(creator-community):=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EB=AC=BC=20=EB=B2=88=EC=97=AD=20=EC=A0=80=EC=9E=A5=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorCommunityTranslation.kt | 37 +++++++++++++++++++ .../CreatorCommunityTranslationRepository.kt | 26 +++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslation.kt create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslationRepository.kt diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslation.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslation.kt new file mode 100644 index 00000000..9a3da987 --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslation.kt @@ -0,0 +1,37 @@ +package kr.co.vividnext.sodalive.v2.creator.channel.community.translation.adapter.out.persistence + +import kr.co.vividnext.sodalive.common.BaseEntity +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.Table +import javax.persistence.UniqueConstraint + +@Entity +@Table( + name = "creator_community_translation", + uniqueConstraints = [ + UniqueConstraint( + name = "uk_creator_community_translation_post_locale", + columnNames = ["creator_community_id", "locale"] + ) + ] +) +class CreatorCommunityTranslation( + @Column(name = "creator_community_id", nullable = false) + val creatorCommunityId: Long, + + @Column(nullable = false, length = 10) + val locale: String, + + @Column(nullable = false, columnDefinition = "text") + var content: String, + + @Column(name = "source_revision", nullable = false) + var sourceRevision: Long, + + @Column(name = "source_hash", nullable = false, length = 64) + var sourceHash: String, + + @Column(name = "source_language", nullable = false, length = 10) + var sourceLanguage: String +) : BaseEntity() diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslationRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslationRepository.kt new file mode 100644 index 00000000..fb603ce8 --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/v2/creator/channel/community/translation/adapter/out/persistence/CreatorCommunityTranslationRepository.kt @@ -0,0 +1,26 @@ +package kr.co.vividnext.sodalive.v2.creator.channel.community.translation.adapter.out.persistence + +import org.springframework.data.jpa.repository.JpaRepository +import org.springframework.data.jpa.repository.Lock +import org.springframework.data.jpa.repository.Query +import org.springframework.data.repository.query.Param +import javax.persistence.LockModeType + +interface CreatorCommunityTranslationRepository : JpaRepository { + fun findByCreatorCommunityIdAndLocale(creatorCommunityId: Long, locale: String): CreatorCommunityTranslation? + + @Lock(LockModeType.PESSIMISTIC_WRITE) + @Query( + "select t from CreatorCommunityTranslation t " + + "where t.creatorCommunityId = :creatorCommunityId and t.locale = :locale" + ) + fun findByCreatorCommunityIdAndLocaleForUpdate( + @Param("creatorCommunityId") creatorCommunityId: Long, + @Param("locale") locale: String + ): CreatorCommunityTranslation? + + fun findByCreatorCommunityIdInAndLocale( + creatorCommunityIds: Collection, + locale: String + ): List +}