test #449

Merged
klaus merged 29 commits from test into main 2026-09-10 07:58:32 +00:00
2 changed files with 63 additions and 0 deletions
Showing only changes of commit 46803f40b5 - Show all commits
@@ -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()
@@ -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<CreatorCommunityTranslation, Long> {
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<Long>,
locale: String
): List<CreatorCommunityTranslation>
}