From 27e90a2e8fdd3ff2f3dded1581b06dd723c9ddcb Mon Sep 17 00:00:00 2001 From: rlaisqls Date: Wed, 4 Oct 2023 13:05:49 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=98=A4=ED=83=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/persistence/repository/TagsRepository.kt | 6 ++++-- .../hs/dsm/inq/domain/question/service/QuestionService.kt | 4 ++-- src/main/resources/application.yaml | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/TagsRepository.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/TagsRepository.kt index 8997ded..83ae57b 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/TagsRepository.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/persistence/repository/TagsRepository.kt @@ -1,11 +1,13 @@ package kr.hs.dsm.inq.domain.question.persistence.repository +import java.awt.print.Pageable import kr.hs.dsm.inq.domain.question.persistence.Category import kr.hs.dsm.inq.domain.question.persistence.Tags +import org.springframework.data.domain.PageRequest import org.springframework.data.repository.CrudRepository interface TagsRepository : CrudRepository { fun findByCategoryAndTagIn(category: Category, tagList: List): List - fun findTop15ByCategory(category: Category): List - fun findTop15(): List + fun findByCategory(category: Category, pageable: Pageable = PageRequest.of(0, 15) as Pageable): List + fun findAllBy(pageable: Pageable = PageRequest.of(0, 15) as Pageable): List } \ No newline at end of file diff --git a/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt b/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt index f90ba10..77c2e82 100644 --- a/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt +++ b/src/main/kotlin/kr/hs/dsm/inq/domain/question/service/QuestionService.kt @@ -176,8 +176,8 @@ class QuestionService( fun getTagList(category: Category?): TagListResponse { val tagList = category?.let { - tagsRepository.findTop15ByCategory(it) - } ?: tagsRepository.findTop15() + tagsRepository.findByCategory(it) + } ?: tagsRepository.findAllBy() return TagListResponse( tagList = tagList.map { it.tag } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 25822e7..0b395cf 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -3,9 +3,9 @@ server: spring: datasource: - url: jdbc:mysql://{DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:inq}?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true&tinyInt1isBit=false&rewriteBatchedStatements=true + url: jdbc:mysql://${DB_HOST:43.200.116.136}:${DB_PORT:3306}/${DB_NAME:inq}?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true&tinyInt1isBit=false&rewriteBatchedStatements=true username: ${MYSQL_USERNAME:root} - password: ${MYSQL_PASSWORD:Cjve94uWhd7UWUt} + password: ${MYSQL_PASSWORD:inqdbpassword} driver-class-name: com.mysql.cj.jdbc.Driver jpa: