관리자 콘텐츠 리스트, 수정 #128
| @@ -69,6 +69,7 @@ class AdminAudioContentQueryRepositoryImpl( | ||||
|                     audioContent.coverImage, | ||||
|                     audioContent.member!!.nickname, | ||||
|                     audioContentTheme.theme, | ||||
|                     audioContentTheme.id, | ||||
|                     audioContent.price, | ||||
|                     audioContent.isAdult, | ||||
|                     audioContent.duration, | ||||
|   | ||||
| @@ -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 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -16,6 +16,7 @@ data class GetAdminContentListItem @QueryProjection constructor( | ||||
|     var coverImageUrl: String, | ||||
|     val creatorNickname: String, | ||||
|     val theme: String, | ||||
|     val themeId: Long, | ||||
|     val price: Int, | ||||
|     val isAdult: Boolean, | ||||
|     val remainingTime: String, | ||||
|   | ||||
| @@ -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