관리자 콘텐츠 수정
- 테마 수정 기능 추가
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| package kr.co.vividnext.sodalive.admin.content | ||||
|  | ||||
| import kr.co.vividnext.sodalive.admin.content.curation.AdminContentCurationRepository | ||||
| import kr.co.vividnext.sodalive.admin.content.theme.AdminContentThemeRepository | ||||
| import kr.co.vividnext.sodalive.aws.cloudfront.AudioContentCloudFront | ||||
| import kr.co.vividnext.sodalive.common.SodaException | ||||
| import org.springframework.beans.factory.annotation.Value | ||||
| @@ -12,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional | ||||
| @Service | ||||
| class AdminContentService( | ||||
|     private val repository: AdminContentRepository, | ||||
|     private val themeRepository: AdminContentThemeRepository, | ||||
|     private val audioContentCloudFront: AudioContentCloudFront, | ||||
|     private val curationRepository: AdminContentCurationRepository, | ||||
|  | ||||
| @@ -120,5 +122,10 @@ class AdminContentService( | ||||
|             val curation = curationRepository.findByIdAndActive(id = request.curationId) | ||||
|             audioContent.curation = curation | ||||
|         } | ||||
|  | ||||
|         if (request.themeId != null) { | ||||
|             val theme = themeRepository.findByIdAndActive(id = request.themeId) | ||||
|             audioContent.theme = theme | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -6,6 +6,7 @@ data class UpdateAdminContentRequest( | ||||
|     val title: String?, | ||||
|     val detail: String?, | ||||
|     val curationId: Long?, | ||||
|     val themeId: Long?, | ||||
|     val isAdult: Boolean?, | ||||
|     val isActive: Boolean?, | ||||
|     val isCommentAvailable: Boolean? | ||||
|   | ||||
| @@ -14,6 +14,7 @@ interface AdminContentThemeRepository : JpaRepository<AudioContentTheme, Long>, | ||||
|  | ||||
| interface AdminContentThemeQueryRepository { | ||||
|     fun findIdByTheme(theme: String): Long? | ||||
|     fun findByIdAndActive(id: Long): AudioContentTheme? | ||||
|     fun getActiveThemes(): List<GetAudioContentThemeResponse> | ||||
| } | ||||
|  | ||||
| @@ -31,6 +32,16 @@ class AdminContentThemeQueryRepositoryImpl( | ||||
|             .fetchOne() | ||||
|     } | ||||
|  | ||||
|     override fun findByIdAndActive(id: Long): AudioContentTheme? { | ||||
|         return queryFactory | ||||
|             .selectFrom(audioContentTheme) | ||||
|             .where( | ||||
|                 audioContentTheme.id.eq(id) | ||||
|                     .and(audioContentTheme.isActive.isTrue) | ||||
|             ) | ||||
|             .fetchOne() | ||||
|     } | ||||
|  | ||||
|     override fun getActiveThemes(): List<GetAudioContentThemeResponse> { | ||||
|         return queryFactory | ||||
|             .select( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user