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