From 7bafb6ba0d949c44e99f425fa9d57c7f2e4516aa Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 6 Feb 2024 16:11:57 +0900 Subject: [PATCH 01/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=BD=98=ED=85=90?= =?UTF-8?q?=EC=B8=A0=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20-=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EC=A1=B0=ED=9A=8C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/AudioContentRepository.kt | 14 +++++++++++--- .../sodalive/content/AudioContentService.kt | 3 ++- .../content/CreatorAdminContentController.kt | 7 ++++--- .../content/CreatorAdminContentRepository.kt | 19 +++++++++++++++++-- .../content/CreatorAdminContentService.kt | 7 ++++--- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt index ff06f60..bd4ff8f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -43,7 +43,7 @@ interface AudioContentQueryRepository { limit: Long = 10 ): List - fun findTotalCountByCreatorId(creatorId: Long, isAdult: Boolean = false): Int + fun findTotalCountByCreatorId(creatorId: Long, isAdult: Boolean = false, categoryId: Long = 0): Int fun getCreatorOtherContentList( cloudfrontHost: String, contentId: Long, @@ -200,7 +200,8 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) override fun findTotalCountByCreatorId( creatorId: Long, - isAdult: Boolean + isAdult: Boolean, + categoryId: Long ): Int { var where = audioContent.member.id.eq(creatorId) .and( @@ -212,8 +213,15 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) where = where.and(audioContent.isAdult.isFalse) } + if (categoryId > 0) { + where = where.and(categoryContent.category.id.eq(categoryId)) + } + return queryFactory - .selectFrom(audioContent) + .select(audioContent.id) + .from(audioContent) + .leftJoin(categoryContent) + .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false))) .where(where) .fetch() .size diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt index 832a9f9..de0e173 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentService.kt @@ -630,7 +630,8 @@ class AudioContentService( ): GetAudioContentListResponse { val totalCount = repository.findTotalCountByCreatorId( creatorId = creatorId, - isAdult = member.auth != null + isAdult = member.auth != null, + categoryId = categoryId ) val audioContentList = repository.findByCreatorId( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt index f19e973..12a6074 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt @@ -20,12 +20,13 @@ import org.springframework.web.multipart.MultipartFile class CreatorAdminContentController(private val service: CreatorAdminContentService) { @GetMapping("/list") fun getAudioContentList( - pageable: Pageable, - @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? + @RequestParam("category-id", required = false) categoryId: Long? = 0, + @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, + pageable: Pageable ) = run { if (member == null) throw SodaException("로그인 정보를 확인해주세요.") - ApiResponse.ok(service.getAudioContentList(pageable, member)) + ApiResponse.ok(service.getAudioContentList(pageable, member, categoryId ?: 0)) } @GetMapping("/search") diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt index e856992..c2598e6 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt @@ -6,6 +6,7 @@ import com.querydsl.core.types.dsl.StringTemplate import com.querydsl.jpa.impl.JPAQueryFactory import kr.co.vividnext.sodalive.content.AudioContent import kr.co.vividnext.sodalive.content.QAudioContent.audioContent +import kr.co.vividnext.sodalive.content.category.QCategoryContent.categoryContent import kr.co.vividnext.sodalive.content.hashtag.QAudioContentHashTag.audioContentHashTag import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme @@ -16,11 +17,12 @@ import java.time.LocalDateTime interface CreatorAdminContentRepository : JpaRepository, CreatorAdminAudioContentQueryRepository interface CreatorAdminAudioContentQueryRepository { - fun getAudioContentTotalCount(memberId: Long, searchWord: String = ""): Int + fun getAudioContentTotalCount(memberId: Long, searchWord: String = "", categoryId: Long = 0): Int fun getAudioContentList( memberId: Long, offset: Long, limit: Long, + categoryId: Long = 0, searchWord: String = "" ): List @@ -32,7 +34,7 @@ interface CreatorAdminAudioContentQueryRepository { class CreatorAdminAudioContentQueryRepositoryImpl( private val queryFactory: JPAQueryFactory ) : CreatorAdminAudioContentQueryRepository { - override fun getAudioContentTotalCount(memberId: Long, searchWord: String): Int { + override fun getAudioContentTotalCount(memberId: Long, searchWord: String, categoryId: Long): Int { var where = audioContent.duration.isNotNull .and(audioContent.member.isNotNull) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) @@ -45,9 +47,15 @@ class CreatorAdminAudioContentQueryRepositoryImpl( ) } + if (categoryId > 0) { + where = where.and(categoryContent.category.id.eq(categoryId)) + } + return queryFactory .select(audioContent.id) .from(audioContent) + .leftJoin(categoryContent) + .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false))) .where(where) .fetch() .size @@ -57,6 +65,7 @@ class CreatorAdminAudioContentQueryRepositoryImpl( memberId: Long, offset: Long, limit: Long, + categoryId: Long, searchWord: String ): List { var where = audioContent.duration.isNotNull @@ -64,6 +73,10 @@ class CreatorAdminAudioContentQueryRepositoryImpl( .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) .and(audioContent.member.id.eq(memberId)) + if (categoryId > 0) { + where = where.and(categoryContent.category.id.eq(categoryId)) + } + if (searchWord.trim().length > 1) { where = where.and( audioContent.title.contains(searchWord) @@ -91,6 +104,8 @@ class CreatorAdminAudioContentQueryRepositoryImpl( ) .from(audioContent) .innerJoin(audioContent.theme, audioContentTheme) + .leftJoin(categoryContent) + .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false))) .where(where) .offset(offset) .limit(limit) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt index 9d1438d..615b5e2 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt @@ -26,12 +26,13 @@ class CreatorAdminContentService( @Value("\${cloud.aws.cloud-front.host}") private val coverImageHost: String ) { - fun getAudioContentList(pageable: Pageable, member: Member): GetCreatorAdminContentListResponse { - val totalCount = repository.getAudioContentTotalCount(memberId = member.id!!) + fun getAudioContentList(pageable: Pageable, member: Member, categoryId: Long): GetCreatorAdminContentListResponse { + val totalCount = repository.getAudioContentTotalCount(memberId = member.id!!, categoryId = categoryId) val audioContentAndThemeList = repository.getAudioContentList( memberId = member.id!!, offset = pageable.offset, - limit = pageable.pageSize.toLong() + limit = pageable.pageSize.toLong(), + categoryId = categoryId ) val audioContentList = audioContentAndThemeList -- 2.40.1 From e3cf7fbfa0e6f1315df3563e4874120bdb74064f Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 6 Feb 2024 21:24:32 +0900 Subject: [PATCH 02/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20-=20?= =?UTF-8?q?=ED=99=9C=EC=84=B1=ED=99=94=EB=90=9C=20=EA=B2=83=EB=A7=8C=20?= =?UTF-8?q?=EA=B0=80=EC=A0=B8=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vividnext/sodalive/content/category/CategoryRepository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt index eacc9bd..6ec6c2b 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt @@ -39,7 +39,7 @@ class CategoryQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : C return queryFactory .select(QGetCategoryListResponse(category.id, category.title)) .from(category) - .where(category.member.id.eq(creatorId)) + .where(category.member.id.eq(creatorId).and(category.isActive.isTrue)) .fetch() } } -- 2.40.1 From a6a279837d53bc00c2d7f7d50cbad98dba2de257 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 6 Feb 2024 21:32:07 +0900 Subject: [PATCH 03/14] =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=20?= =?UTF-8?q?=EC=88=9C=EC=84=9C=20=EB=B3=80=EA=B2=BD=20API=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/content/category/CategoryController.kt | 11 +++++++++++ .../sodalive/content/category/CategoryRepository.kt | 6 +++++- .../sodalive/content/category/CategoryService.kt | 11 +++++++++++ .../content/category/UpdateCategoryOrdersRequest.kt | 3 +++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/content/category/UpdateCategoryOrdersRequest.kt diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryController.kt index b3db249..0906e5f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryController.kt @@ -40,6 +40,17 @@ class CategoryController(private val service: CategoryService) { ApiResponse.ok(service.modifyCategory(request = request, member = member)) } + @PutMapping("/orders") + @PreAuthorize("hasRole('CREATOR')") + fun updateCategoryOrders( + @RequestBody request: UpdateCategoryOrdersRequest, + @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? + ) = run { + if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + + ApiResponse.ok(service.updateCategoryOrders(request = request, member = member)) + } + @DeleteMapping("/{id}") @PreAuthorize("hasRole('CREATOR')") fun deleteCategory( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt index 6ec6c2b..b9fbf0b 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryRepository.kt @@ -39,7 +39,11 @@ class CategoryQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) : C return queryFactory .select(QGetCategoryListResponse(category.id, category.title)) .from(category) - .where(category.member.id.eq(creatorId).and(category.isActive.isTrue)) + .where( + category.member.id.eq(creatorId) + .and(category.isActive.isTrue) + ) + .orderBy(category.orders.asc()) .fetch() } } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryService.kt index 3afe603..00c6c9a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/CategoryService.kt @@ -86,6 +86,17 @@ class CategoryService( categoryContentRepository.deleteByCategoryId(categoryId = categoryId) } + @Transactional + fun updateCategoryOrders(request: UpdateCategoryOrdersRequest, member: Member) { + for (index in request.ids.indices) { + val category = repository.findByIdAndMemberId(categoryId = request.ids[index], memberId = member.id!!) + + if (category != null) { + category.orders = index + 1 + } + } + } + fun getCategoryList(creatorId: Long, memberId: Long): List { val isBlocked = blockMemberRepository.isBlocked(blockedMemberId = memberId, memberId = creatorId) if (isBlocked) throw SodaException("잘못된 접근입니다.") diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/category/UpdateCategoryOrdersRequest.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/UpdateCategoryOrdersRequest.kt new file mode 100644 index 0000000..93ef105 --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/category/UpdateCategoryOrdersRequest.kt @@ -0,0 +1,3 @@ +package kr.co.vividnext.sodalive.content.category + +data class UpdateCategoryOrdersRequest(val ids: List) -- 2.40.1 From d3ffa1d40a6e392153bca885698c90ca1cc35b4a Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 6 Feb 2024 22:06:05 +0900 Subject: [PATCH 04/14] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20-=20=EC=A0=95=EB=A0=AC=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vividnext/sodalive/content/AudioContentRepository.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt index bd4ff8f..1a02e7f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/content/AudioContentRepository.kt @@ -194,7 +194,13 @@ class AudioContentQueryRepositoryImpl(private val queryFactory: JPAQueryFactory) .where(where) .offset(offset) .limit(limit) - .orderBy(pinContent.isActive.desc(), pinContent.updatedAt.desc(), orderBy, audioContent.id.desc()) + .orderBy( + pinContent.isActive.desc(), + pinContent.updatedAt.desc(), + orderBy, + audioContent.updatedAt.desc(), + audioContent.id.desc() + ) .fetch() } -- 2.40.1 From 354c8c3d4ad8b0dd2c7455edf82f1b3fcb7b4e89 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 6 Feb 2024 22:42:40 +0900 Subject: [PATCH 05/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=BD=98=ED=85=90?= =?UTF-8?q?=EC=B8=A0=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20-=20=EB=B6=88?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20=EB=A1=9C=EC=A7=81=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/CreatorAdminContentController.kt | 7 +++---- .../content/CreatorAdminContentRepository.kt | 19 ++----------------- .../content/CreatorAdminContentService.kt | 7 +++---- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt index 12a6074..f19e973 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentController.kt @@ -20,13 +20,12 @@ import org.springframework.web.multipart.MultipartFile class CreatorAdminContentController(private val service: CreatorAdminContentService) { @GetMapping("/list") fun getAudioContentList( - @RequestParam("category-id", required = false) categoryId: Long? = 0, - @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, - pageable: Pageable + pageable: Pageable, + @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { if (member == null) throw SodaException("로그인 정보를 확인해주세요.") - ApiResponse.ok(service.getAudioContentList(pageable, member, categoryId ?: 0)) + ApiResponse.ok(service.getAudioContentList(pageable, member)) } @GetMapping("/search") diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt index c2598e6..e856992 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentRepository.kt @@ -6,7 +6,6 @@ import com.querydsl.core.types.dsl.StringTemplate import com.querydsl.jpa.impl.JPAQueryFactory import kr.co.vividnext.sodalive.content.AudioContent import kr.co.vividnext.sodalive.content.QAudioContent.audioContent -import kr.co.vividnext.sodalive.content.category.QCategoryContent.categoryContent import kr.co.vividnext.sodalive.content.hashtag.QAudioContentHashTag.audioContentHashTag import kr.co.vividnext.sodalive.content.hashtag.QHashTag.hashTag import kr.co.vividnext.sodalive.content.theme.QAudioContentTheme.audioContentTheme @@ -17,12 +16,11 @@ import java.time.LocalDateTime interface CreatorAdminContentRepository : JpaRepository, CreatorAdminAudioContentQueryRepository interface CreatorAdminAudioContentQueryRepository { - fun getAudioContentTotalCount(memberId: Long, searchWord: String = "", categoryId: Long = 0): Int + fun getAudioContentTotalCount(memberId: Long, searchWord: String = ""): Int fun getAudioContentList( memberId: Long, offset: Long, limit: Long, - categoryId: Long = 0, searchWord: String = "" ): List @@ -34,7 +32,7 @@ interface CreatorAdminAudioContentQueryRepository { class CreatorAdminAudioContentQueryRepositoryImpl( private val queryFactory: JPAQueryFactory ) : CreatorAdminAudioContentQueryRepository { - override fun getAudioContentTotalCount(memberId: Long, searchWord: String, categoryId: Long): Int { + override fun getAudioContentTotalCount(memberId: Long, searchWord: String): Int { var where = audioContent.duration.isNotNull .and(audioContent.member.isNotNull) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) @@ -47,15 +45,9 @@ class CreatorAdminAudioContentQueryRepositoryImpl( ) } - if (categoryId > 0) { - where = where.and(categoryContent.category.id.eq(categoryId)) - } - return queryFactory .select(audioContent.id) .from(audioContent) - .leftJoin(categoryContent) - .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false))) .where(where) .fetch() .size @@ -65,7 +57,6 @@ class CreatorAdminAudioContentQueryRepositoryImpl( memberId: Long, offset: Long, limit: Long, - categoryId: Long, searchWord: String ): List { var where = audioContent.duration.isNotNull @@ -73,10 +64,6 @@ class CreatorAdminAudioContentQueryRepositoryImpl( .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) .and(audioContent.member.id.eq(memberId)) - if (categoryId > 0) { - where = where.and(categoryContent.category.id.eq(categoryId)) - } - if (searchWord.trim().length > 1) { where = where.and( audioContent.title.contains(searchWord) @@ -104,8 +91,6 @@ class CreatorAdminAudioContentQueryRepositoryImpl( ) .from(audioContent) .innerJoin(audioContent.theme, audioContentTheme) - .leftJoin(categoryContent) - .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(false))) .where(where) .offset(offset) .limit(limit) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt index 615b5e2..9d1438d 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/CreatorAdminContentService.kt @@ -26,13 +26,12 @@ class CreatorAdminContentService( @Value("\${cloud.aws.cloud-front.host}") private val coverImageHost: String ) { - fun getAudioContentList(pageable: Pageable, member: Member, categoryId: Long): GetCreatorAdminContentListResponse { - val totalCount = repository.getAudioContentTotalCount(memberId = member.id!!, categoryId = categoryId) + fun getAudioContentList(pageable: Pageable, member: Member): GetCreatorAdminContentListResponse { + val totalCount = repository.getAudioContentTotalCount(memberId = member.id!!) val audioContentAndThemeList = repository.getAudioContentList( memberId = member.id!!, offset = pageable.offset, - limit = pageable.pageSize.toLong(), - categoryId = categoryId + limit = pageable.pageSize.toLong() ) val audioContentList = audioContentAndThemeList -- 2.40.1 From 286629836c238f521c2751861dd0277e05606560 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 6 Feb 2024 23:59:51 +0900 Subject: [PATCH 06/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20API=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorAdminCategoryController.kt | 52 +++++++++++++++++++ .../CreatorAdminCategoryRepository.kt | 49 +++++++++++++++++ .../category/CreatorAdminCategoryService.kt | 32 ++++++++++++ .../category/GetContentInCategoryResponse.kt | 9 ++++ .../SearchContentNotInCategoryResponse.kt | 8 +++ 5 files changed, 150 insertions(+) create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryController.kt create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt create mode 100644 src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/SearchContentNotInCategoryResponse.kt diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryController.kt new file mode 100644 index 0000000..37aaeca --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryController.kt @@ -0,0 +1,52 @@ +package kr.co.vividnext.sodalive.creator.admin.content.category + +import kr.co.vividnext.sodalive.common.ApiResponse +import kr.co.vividnext.sodalive.common.SodaException +import kr.co.vividnext.sodalive.member.Member +import org.springframework.data.domain.Pageable +import org.springframework.security.access.prepost.PreAuthorize +import org.springframework.security.core.annotation.AuthenticationPrincipal +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.RestController + +@RestController +@PreAuthorize("hasRole('CREATOR')") +@RequestMapping("/creator-admin/content-category") +class CreatorAdminCategoryController(private val service: CreatorAdminCategoryService) { + @GetMapping("/search") + fun searchContentNotInCategory( + @RequestParam(value = "category_id") categoryId: Long, + @RequestParam(value = "search_word") searchWord: String, + @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? + ) = run { + if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + + ApiResponse.ok( + service.searchContentNotInCategory( + categoryId = categoryId, + searchWord = searchWord, + memberId = member.id!! + ) + ) + } + + @GetMapping + fun getContentInCategory( + @RequestParam(value = "category_id") categoryId: Long, + @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, + pageable: Pageable + ) = run { + if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + + ApiResponse.ok( + service.getContentInCategory( + categoryId = categoryId, + memberId = member.id!!, + offset = pageable.offset, + limit = pageable.pageSize.toLong() + ) + ) + } +} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt new file mode 100644 index 0000000..013c15a --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -0,0 +1,49 @@ +package kr.co.vividnext.sodalive.creator.admin.content.category + +import com.querydsl.jpa.impl.JPAQueryFactory +import kr.co.vividnext.sodalive.content.QAudioContent.audioContent +import kr.co.vividnext.sodalive.content.category.QCategoryContent.categoryContent +import org.springframework.stereotype.Repository + +@Repository +class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) { + fun searchContentNotInCategory( + categoryId: Long, + searchWord: String, + memberId: Long + ): List { + return queryFactory + .select(QSearchContentNotInCategoryResponse(audioContent.id, audioContent.title)) + .from(audioContent) + .leftJoin(categoryContent) + .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(true))) + .where( + audioContent.duration.isNotNull + .and(audioContent.member.isNotNull) + .and(audioContent.member.id.eq(memberId)) + .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) + .and(audioContent.title.contains(searchWord)) + ) + .fetch() + } + + fun getContentInCategory( + categoryId: Long, + memberId: Long, + offset: Long, + limit: Long + ): List { + return queryFactory + .select(QGetContentInCategoryResponse(audioContent.id, audioContent.title, audioContent.isAdult)) + .from(audioContent) + .leftJoin(categoryContent) + .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.isTrue)) + .where( + audioContent.duration.isNotNull + .and(audioContent.member.isNotNull) + .and(audioContent.member.id.eq(memberId)) + .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) + ) + .fetch() + } +} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt new file mode 100644 index 0000000..45021f6 --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt @@ -0,0 +1,32 @@ +package kr.co.vividnext.sodalive.creator.admin.content.category + +import org.springframework.stereotype.Service + +@Service +class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRepository) { + fun searchContentNotInCategory( + categoryId: Long, + searchWord: String, + memberId: Long + ): List { + return repository.searchContentNotInCategory( + categoryId, + searchWord, + memberId + ) + } + + fun getContentInCategory( + categoryId: Long, + memberId: Long, + offset: Long, + limit: Long + ): List { + return repository.getContentInCategory( + categoryId, + memberId, + offset, + limit + ) + } +} diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt new file mode 100644 index 0000000..4891a87 --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt @@ -0,0 +1,9 @@ +package kr.co.vividnext.sodalive.creator.admin.content.category + +import com.querydsl.core.annotations.QueryProjection + +data class GetContentInCategoryResponse @QueryProjection constructor( + val contentId: Long, + val title: String, + val isAdult: Boolean +) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/SearchContentNotInCategoryResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/SearchContentNotInCategoryResponse.kt new file mode 100644 index 0000000..cf103c9 --- /dev/null +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/SearchContentNotInCategoryResponse.kt @@ -0,0 +1,8 @@ +package kr.co.vividnext.sodalive.creator.admin.content.category + +import com.querydsl.core.annotations.QueryProjection + +data class SearchContentNotInCategoryResponse @QueryProjection constructor( + val contentId: Long, + val title: String +) -- 2.40.1 From e76eed72744047281b8e42ee197e15c3a08f5896 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 00:26:17 +0900 Subject: [PATCH 07/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20API=20-=20=EC=A0=84=EC=B2=B4=20=EA=B0=9C?= =?UTF-8?q?=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreatorAdminCategoryRepository.kt | 24 ++++++++++++++++--- .../category/CreatorAdminCategoryService.kt | 7 ++++-- .../category/GetContentInCategoryResponse.kt | 7 +++++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index 013c15a..2d4e76f 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -27,19 +27,37 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .fetch() } + fun getContentInCategoryTotalCount(categoryId: Long, memberId: Long): Int { + return queryFactory + .select(audioContent.id) + .from(audioContent) + .leftJoin(categoryContent) + .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.isTrue)) + .where( + categoryContent.category.id.eq(categoryId) + .and(audioContent.duration.isNotNull) + .and(audioContent.member.isNotNull) + .and(audioContent.member.id.eq(memberId)) + .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) + ) + .fetch() + .size + } + fun getContentInCategory( categoryId: Long, memberId: Long, offset: Long, limit: Long - ): List { + ): List { return queryFactory - .select(QGetContentInCategoryResponse(audioContent.id, audioContent.title, audioContent.isAdult)) + .select(QGetContentInCategoryItem(audioContent.id, audioContent.title, audioContent.isAdult)) .from(audioContent) .leftJoin(categoryContent) .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.isTrue)) .where( - audioContent.duration.isNotNull + categoryContent.category.id.eq(categoryId) + .and(audioContent.duration.isNotNull) .and(audioContent.member.isNotNull) .and(audioContent.member.id.eq(memberId)) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt index 45021f6..5531a28 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt @@ -21,12 +21,15 @@ class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRe memberId: Long, offset: Long, limit: Long - ): List { - return repository.getContentInCategory( + ): GetContentInCategoryResponse { + val totalCount = repository.getContentInCategoryTotalCount(categoryId, memberId) + val items = repository.getContentInCategory( categoryId, memberId, offset, limit ) + + return GetContentInCategoryResponse(totalCount, items) } } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt index 4891a87..b7d2ebb 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt @@ -2,7 +2,12 @@ package kr.co.vividnext.sodalive.creator.admin.content.category import com.querydsl.core.annotations.QueryProjection -data class GetContentInCategoryResponse @QueryProjection constructor( +data class GetContentInCategoryResponse( + val totalCount: Int, + val items: List +) + +data class GetContentInCategoryItem @QueryProjection constructor( val contentId: Long, val title: String, val isAdult: Boolean -- 2.40.1 From db0e526896ded65764054c5beb8ad0e70f2be933 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 04:15:01 +0900 Subject: [PATCH 08/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20API=20-=20=EC=BB=A4=EB=B2=84=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/category/CreatorAdminCategoryRepository.kt | 10 +++++++++- .../content/category/CreatorAdminCategoryService.kt | 9 ++++++++- .../content/category/GetContentInCategoryResponse.kt | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index 2d4e76f..f46e2df 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -45,13 +45,21 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) } fun getContentInCategory( + imageHost: String, categoryId: Long, memberId: Long, offset: Long, limit: Long ): List { return queryFactory - .select(QGetContentInCategoryItem(audioContent.id, audioContent.title, audioContent.isAdult)) + .select( + QGetContentInCategoryItem( + audioContent.id, + audioContent.title, + audioContent.isAdult, + audioContent.coverImage.prepend("/").prepend(imageHost) + ) + ) .from(audioContent) .leftJoin(categoryContent) .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.isTrue)) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt index 5531a28..ba1a2f7 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryService.kt @@ -1,9 +1,15 @@ package kr.co.vividnext.sodalive.creator.admin.content.category +import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Service @Service -class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRepository) { +class CreatorAdminCategoryService( + private val repository: CreatorAdminCategoryRepository, + + @Value("\${cloud.aws.cloud-front.host}") + private val imageHost: String +) { fun searchContentNotInCategory( categoryId: Long, searchWord: String, @@ -24,6 +30,7 @@ class CreatorAdminCategoryService(private val repository: CreatorAdminCategoryRe ): GetContentInCategoryResponse { val totalCount = repository.getContentInCategoryTotalCount(categoryId, memberId) val items = repository.getContentInCategory( + imageHost, categoryId, memberId, offset, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt index b7d2ebb..2004597 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/GetContentInCategoryResponse.kt @@ -10,5 +10,6 @@ data class GetContentInCategoryResponse( data class GetContentInCategoryItem @QueryProjection constructor( val contentId: Long, val title: String, - val isAdult: Boolean + val isAdult: Boolean, + val image: String ) -- 2.40.1 From 525f837e217804e0cf97c407346c8f50b4753e2b Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 05:11:33 +0900 Subject: [PATCH 09/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20-=20=ED=95=B4=EB=8B=B9=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=EC=97=90=20=EC=86=8D=ED=95=9C=20=EC=BD=98?= =?UTF-8?q?=ED=85=90=EC=B8=A0=EB=8A=94=20=EA=B2=80=EC=83=89=EB=90=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/content/category/CreatorAdminCategoryRepository.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index f46e2df..53da456 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -23,6 +23,7 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .and(audioContent.member.id.eq(memberId)) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) .and(audioContent.title.contains(searchWord)) + .and(categoryContent.category.id.ne(categoryId)) ) .fetch() } -- 2.40.1 From 9a30dd6de519167beed9dadd2f62a6dab149fdd9 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 05:36:08 +0900 Subject: [PATCH 10/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20-=20=ED=95=B4=EB=8B=B9=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=EC=97=90=20=EC=86=8D=ED=95=9C=20=EC=BD=98?= =?UTF-8?q?=ED=85=90=EC=B8=A0=EB=8A=94=20=EA=B2=80=EC=83=89=EB=90=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/content/category/CreatorAdminCategoryRepository.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index 53da456..9657d65 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -25,6 +25,7 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .and(audioContent.title.contains(searchWord)) .and(categoryContent.category.id.ne(categoryId)) ) + .groupBy(audioContent.id) .fetch() } -- 2.40.1 From ebb969c039e007b319ca70de7cc9cf7b0b38276d Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 06:08:44 +0900 Subject: [PATCH 11/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20-=20=ED=95=B4=EB=8B=B9=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=EC=97=90=20=EC=86=8D=ED=95=9C=20=EC=BD=98?= =?UTF-8?q?=ED=85=90=EC=B8=A0=EB=8A=94=20=EA=B2=80=EC=83=89=EB=90=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/content/category/CreatorAdminCategoryRepository.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index 9657d65..2e49fd6 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -23,9 +23,8 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .and(audioContent.member.id.eq(memberId)) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) .and(audioContent.title.contains(searchWord)) - .and(categoryContent.category.id.ne(categoryId)) + .and(categoryContent.category.id.eq(categoryId)) ) - .groupBy(audioContent.id) .fetch() } -- 2.40.1 From 113d29fab0ea40dfd833848887bad5da18aaa68d Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 06:21:03 +0900 Subject: [PATCH 12/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20-=20=ED=8E=98=EC=9D=B4=EC=A7=95=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC,=20=EC=A0=95=EB=A0=AC=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EC=B5=9C=EA=B7=BC=EC=97=90=20=EC=B6=94=EA=B0=80=ED=95=9C=20?= =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=EA=B0=80=20=EB=A8=BC=EC=A0=80=20?= =?UTF-8?q?=EB=82=98=EC=98=A4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/content/category/CreatorAdminCategoryRepository.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index 2e49fd6..a826eba 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -71,6 +71,9 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .and(audioContent.member.id.eq(memberId)) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) ) + .orderBy(categoryContent.updatedAt.desc()) + .offset(offset) + .limit(limit) .fetch() } } -- 2.40.1 From 3df0b1fcec7d140cf5d83d9350866a4a2991a9a5 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 09:12:37 +0900 Subject: [PATCH 13/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20-=20=EA=B2=80=EC=83=89=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/category/CreatorAdminCategoryRepository.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index a826eba..179da66 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -16,14 +16,17 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .select(QSearchContentNotInCategoryResponse(audioContent.id, audioContent.title)) .from(audioContent) .leftJoin(categoryContent) - .on(audioContent.id.eq(categoryContent.content.id).and(categoryContent.isActive.ne(true))) + .on( + audioContent.id.eq(categoryContent.content.id) + .and(categoryContent.isActive.ne(true)) + .and(categoryContent.category.id.eq(categoryId)) + ) .where( audioContent.duration.isNotNull .and(audioContent.member.isNotNull) .and(audioContent.member.id.eq(memberId)) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) .and(audioContent.title.contains(searchWord)) - .and(categoryContent.category.id.eq(categoryId)) ) .fetch() } -- 2.40.1 From aea1f1889e91b8648aab5fa82a891e44ba725b81 Mon Sep 17 00:00:00 2001 From: Klaus Date: Wed, 7 Feb 2024 09:38:52 +0900 Subject: [PATCH 14/14] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=B9=B4=ED=85=8C?= =?UTF-8?q?=EA=B3=A0=EB=A6=AC=20=EC=BD=98=ED=85=90=EC=B8=A0=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20-=20=EA=B2=80=EC=83=89=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/content/category/CreatorAdminCategoryRepository.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt index 179da66..35b8196 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/creator/admin/content/category/CreatorAdminCategoryRepository.kt @@ -18,7 +18,6 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .leftJoin(categoryContent) .on( audioContent.id.eq(categoryContent.content.id) - .and(categoryContent.isActive.ne(true)) .and(categoryContent.category.id.eq(categoryId)) ) .where( @@ -27,6 +26,7 @@ class CreatorAdminCategoryRepository(private val queryFactory: JPAQueryFactory) .and(audioContent.member.id.eq(memberId)) .and(audioContent.isActive.isTrue.or(audioContent.releaseDate.isNotNull)) .and(audioContent.title.contains(searchWord)) + .and(categoryContent.id.isNull.or(categoryContent.isActive.isFalse)) ) .fetch() } -- 2.40.1