parent
e0565f7eed
commit
93b0565368
|
@ -18,6 +18,7 @@ interface AdminHashTagCurationRepository :
|
|||
interface AdminHashTagCurationQueryRepository {
|
||||
fun getContentHashTagCurationList(): List<GetAdminContentHashTagCurationResponse>
|
||||
fun searchHashTagCurationContentItem(curationId: Long, searchWord: String): List<SearchCurationItemResponse>
|
||||
fun isExistsTag(tag: String): Boolean
|
||||
}
|
||||
|
||||
@Repository
|
||||
|
@ -69,4 +70,12 @@ class AdminHashTagCurationQueryRepositoryImpl(
|
|||
)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
override fun isExistsTag(tag: String): Boolean {
|
||||
return queryFactory
|
||||
.select(contentHashTagCuration.id)
|
||||
.from(contentHashTagCuration)
|
||||
.where(contentHashTagCuration.tag.eq(tag))
|
||||
.fetch().isNotEmpty()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,12 @@ class AdminHashTagCurationService(
|
|||
) {
|
||||
@Transactional
|
||||
fun createContentHashTagCuration(request: CreateContentHashTagCurationRequest) {
|
||||
val isExists = repository.isExistsTag(tag = request.tag.trim())
|
||||
|
||||
if (isExists) {
|
||||
throw SodaException("이미 등록된 태그 입니다.")
|
||||
}
|
||||
|
||||
repository.save(
|
||||
ContentHashTagCuration(
|
||||
tag = request.tag,
|
||||
|
|
Loading…
Reference in New Issue