Skip to content

Commit

Permalink
fix: 오타
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaisqls committed Oct 4, 2023
1 parent 67383a9 commit e4a47b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/main/kotlin/kr/hs/dsm/inq/common/util/PageUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ package kr.hs.dsm.inq.common.util
import com.querydsl.jpa.impl.JPAQuery
import kr.hs.dsm.inq.common.util.PageUtil.getLimit
import kr.hs.dsm.inq.common.util.PageUtil.getOffset
import org.springframework.data.domain.PageRequest
import org.springframework.data.domain.Pageable

val defaultPage: Pageable = PageRequest.of(0, 15)

object PageUtil {
const val pageSize = 5L
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ package kr.hs.dsm.inq.domain.question.persistence.repository

import kr.hs.dsm.inq.domain.question.persistence.Category
import kr.hs.dsm.inq.domain.question.persistence.Tags
import org.springframework.data.domain.Pageable
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.repository.CrudRepository

interface TagsRepository : CrudRepository<Tags, Long> {
interface TagsRepository : JpaRepository<Tags, Long> {
fun findByCategoryAndTagIn(category: Category, tagList: List<String>): List<Tags>
fun findTop15ByCategory(category: Category): List<Tags>
fun findTop15(): List<Tags>
fun findByCategory(category: Category, pageable: Pageable): List<Tags>
fun findAllBy(pageable: Pageable): List<Tags>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kr.hs.dsm.inq.domain.question.service

import kr.hs.dsm.inq.common.util.SecurityUtil
import kr.hs.dsm.inq.common.util.defaultPage
import kr.hs.dsm.inq.domain.question.exception.AlreadyDislikedPostException
import kr.hs.dsm.inq.domain.question.exception.AlreadyLikedPostException
import kr.hs.dsm.inq.domain.question.exception.AnswerNotFoundException
Expand Down Expand Up @@ -176,8 +177,8 @@ class QuestionService(
fun getTagList(category: Category?): TagListResponse {

val tagList = category?.let {
tagsRepository.findTop15ByCategory(it)
} ?: tagsRepository.findTop15()
tagsRepository.findByCategory(it, defaultPage)
} ?: tagsRepository.findAllBy(defaultPage)

return TagListResponse(
tagList = tagList.map { it.tag }
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e4a47b5

Please sign in to comment.