diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/controller/FestivalController.kt b/src/main/kotlin/busanVibe/busan/domain/festival/controller/FestivalController.kt index 83670eb..c4cb7a7 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/controller/FestivalController.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/controller/FestivalController.kt @@ -33,12 +33,11 @@ class FestivalController( @GetMapping("/{festivalId}") @Operation(summary = "지역축제 상세 조회") fun festivalDetails( - @PathVariable("festivalId") festivalId: Long, - @RequestParam("sort") sort: FestivalSortType, - @RequestParam("status")status: FestivalStatus - ):ApiResponse?{ + @PathVariable("festivalId") festivalId: Long + ):ApiResponse{ - return null; + val festivalDetails = festivalQueryService.getFestivalDetails(festivalId) + return ApiResponse.onSuccess(festivalDetails); } } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/converter/FestivalConverter.kt b/src/main/kotlin/busanVibe/busan/domain/festival/converter/FestivalConverter.kt index 26d225f..709f74e 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/converter/FestivalConverter.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/converter/FestivalConverter.kt @@ -21,7 +21,7 @@ class FestivalConverter { ) } - private fun convertFestivalDate(date: Date): String { + public fun convertFestivalDate(date: Date): String { val formatter: SimpleDateFormat = SimpleDateFormat("yyyy.MM.dd") return formatter.format(date) } diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/domain/Festival.kt b/src/main/kotlin/busanVibe/busan/domain/festival/domain/Festival.kt index 66660b5..a069861 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/domain/Festival.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/domain/Festival.kt @@ -6,9 +6,11 @@ import jakarta.persistence.Column import jakarta.persistence.Entity import jakarta.persistence.EnumType import jakarta.persistence.Enumerated +import jakarta.persistence.FetchType import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType import jakarta.persistence.Id +import jakarta.persistence.OneToMany import java.util.Date @Entity @@ -33,11 +35,29 @@ class Festival ( @Column(nullable = false, columnDefinition = "TEXT") val introduction: String, + @Column(nullable = false) + val fee: Int, + + @Column(nullable = false) + val phone: String, + + @Column(nullable = false) + val siteUrl: String, + + // 연관관계 @Enumerated(EnumType.STRING) @Column(nullable = false) val status: FestivalStatus, - ): BaseEntity(){ + @OneToMany(mappedBy = "festival", fetch = FetchType.LAZY) + val festivalImages: Set, + + @OneToMany(mappedBy = "festival", fetch = FetchType.LAZY) + val festivalLikes: Set + + +): BaseEntity(){ + } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/domain/FestivalImage.kt b/src/main/kotlin/busanVibe/busan/domain/festival/domain/FestivalImage.kt index d601be3..2b640ce 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/domain/FestivalImage.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/domain/FestivalImage.kt @@ -21,7 +21,7 @@ class FestivalImage( val imgUrl : String, @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "user_id") + @JoinColumn(name = "festival_id") val festival: Festival ): BaseEntity() { diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalDetailsDTO.kt b/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalDetailsDTO.kt index 41dbdd4..f394b67 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalDetailsDTO.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalDetailsDTO.kt @@ -1,5 +1,6 @@ package busanVibe.busan.domain.festival.dto +import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming @@ -8,15 +9,17 @@ class FestivalDetailsDTO { @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) data class DetailDto( val id: Long, - val img: String, + val img: Set, val name: String, - val likeCount: Integer, + val likeCount: Int, + @get:JsonProperty("is_like") val isLike: Boolean, val startDate: String, val endDate: String, val region: String, val phone: String, - val fee: Integer, + val fee: Int, + val siteUrl: String, val introduce: String ) diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalListResponseDTO.kt b/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalListResponseDTO.kt index eaa9105..bfc5641 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalListResponseDTO.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalListResponseDTO.kt @@ -1,5 +1,6 @@ package busanVibe.busan.domain.festival.dto +import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming @@ -18,6 +19,7 @@ class FestivalListResponseDTO { val startDate: String, val endDate: String, val region: String, + @get:JsonProperty("is_like") val isLike: Boolean, val likeCount: Int, ) diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalLikesRepository.kt b/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalLikesRepository.kt index 57929a2..4e5d989 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalLikesRepository.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalLikesRepository.kt @@ -7,5 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository interface FestivalLikesRepository: JpaRepository { fun findAllByFestivalIn(festivalList: List): List + fun findAllByFestivalIn(festivalList: Set): List + } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalRepository.kt b/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalRepository.kt index 1b7ad23..1778138 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalRepository.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/repository/FestivalRepository.kt @@ -6,7 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository import org.springframework.data.jpa.repository.Query import org.springframework.data.repository.query.Param -interface FestivalRepository: JpaRepository { +interface FestivalRepository: JpaRepository { @Query( """ @@ -15,4 +15,13 @@ interface FestivalRepository: JpaRepository { """) fun getFestivalList(@Param("status") status: FestivalStatus): List + @Query(""" + SELECT f FROM Festival f + LEFT JOIN FETCH f.festivalLikes + LEFT JOIN FETCH f.festivalImages + WHERE f.id = :id + """) + fun findByIdWithLikesAndImages(@Param("id") id: Long): Festival? + + } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/festival/service/FestivalQueryService.kt b/src/main/kotlin/busanVibe/busan/domain/festival/service/FestivalQueryService.kt index d4d488e..8a294c7 100644 --- a/src/main/kotlin/busanVibe/busan/domain/festival/service/FestivalQueryService.kt +++ b/src/main/kotlin/busanVibe/busan/domain/festival/service/FestivalQueryService.kt @@ -3,6 +3,7 @@ package busanVibe.busan.domain.festival.service import busanVibe.busan.domain.festival.converter.FestivalConverter import busanVibe.busan.domain.festival.domain.Festival import busanVibe.busan.domain.festival.domain.FestivalLike +import busanVibe.busan.domain.festival.dto.FestivalDetailsDTO import busanVibe.busan.domain.festival.dto.FestivalListResponseDTO import busanVibe.busan.domain.festival.enums.FestivalSortType import busanVibe.busan.domain.festival.enums.FestivalStatus @@ -11,6 +12,9 @@ import busanVibe.busan.domain.festival.repository.FestivalLikesRepository import busanVibe.busan.domain.festival.repository.FestivalRepository import busanVibe.busan.domain.user.data.User import busanVibe.busan.domain.user.service.login.AuthService +import busanVibe.busan.global.apiPayload.code.status.ErrorStatus +import busanVibe.busan.global.apiPayload.exception.handler.ExceptionHandler +import org.slf4j.LoggerFactory import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional @@ -21,6 +25,8 @@ class FestivalQueryService( private val festivalLikesRepository: FestivalLikesRepository ) { + val log = LoggerFactory.getLogger(FestivalQueryService::class.java) + @Transactional(readOnly = true) fun getFestivalList(sort: FestivalSortType?, status: FestivalStatus?): FestivalListResponseDTO.ListDto{ @@ -79,4 +85,43 @@ class FestivalQueryService( return FestivalListResponseDTO.ListDto(sortedList) } + fun getFestivalDetails(festivalId: Long):FestivalDetailsDTO.DetailDto{ + + // Festival -> id, name, startDate, endDate, place, introduction + // FestivalLike -> count, isLike + // FestivalImage -> img + + // user 추출 + val currentUser: User = AuthService().getCurrentUser() + + // 축제 조회 + val festival: Festival? = festivalRepository.findByIdWithLikesAndImages(festivalId) + + // 검증 + festival ?: throw ExceptionHandler(ErrorStatus.FESTIVAL_NOT_FOUND) + + // 이미지 조회 + val imgUrlSet: Set = festival.festivalImages + .map { it.imgUrl } + .toSet() + + // 좋아요 조회 + val likeList: Set = festival.festivalLikes + + return FestivalDetailsDTO.DetailDto( + id = festivalId, + img = imgUrlSet, + name = festival.name, + likeCount = likeList.size, + isLike = likeList.any { it.user.id == currentUser.id }, + startDate = FestivalConverter().convertFestivalDate(festival.startDate), + endDate = FestivalConverter().convertFestivalDate(festival.endDate), + region = festival.place, + fee = festival.fee, + siteUrl = festival.siteUrl, + introduce = festival.introduction, + phone = festival.phone, + ) + } + } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/place/converter/PlaceDetailsConverter.kt b/src/main/kotlin/busanVibe/busan/domain/place/converter/PlaceDetailsConverter.kt index 1efc334..18324c4 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/converter/PlaceDetailsConverter.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/converter/PlaceDetailsConverter.kt @@ -29,8 +29,8 @@ class PlaceDetailsConverter( ): PlaceResponseDTO.PlaceDetailsDto.SightDto = PlaceResponseDTO.PlaceDetailsDto.SightDto( id = place.id, name = place.name, - type = place.type.korean, - img = placeImages.firstOrNull()?.imgUrl, + type = place.type.capitalEnglish, + img = placeImages.map { it.imgUrl }, congestionLevel = redisUtil.getRedisCongestion(place.id), grade = if (placeReviews.isNotEmpty()) { placeReviews.map { it.score }.average().toFloat() @@ -57,8 +57,8 @@ class PlaceDetailsConverter( ): PlaceResponseDTO.PlaceDetailsDto.RestaurantDto = PlaceResponseDTO.PlaceDetailsDto.RestaurantDto( id = place.id, name = place.name, - type = place.type.korean, - img = placeImages.firstOrNull()?.imgUrl, + type = place.type.capitalEnglish, + img = placeImages.map { it.imgUrl }, congestionLevel = redisUtil.getRedisCongestion(place.id), grade = placeReviews.map { it.score }.average().toFloat(), reviewAmount = placeReviews.size, diff --git a/src/main/kotlin/busanVibe/busan/domain/place/domain/Place.kt b/src/main/kotlin/busanVibe/busan/domain/place/domain/Place.kt index ebb7bb3..b90c860 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/domain/Place.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/domain/Place.kt @@ -10,6 +10,7 @@ import jakarta.persistence.FetchType import jakarta.persistence.GeneratedValue import jakarta.persistence.GenerationType import jakarta.persistence.Id +import jakarta.persistence.OneToMany import jakarta.persistence.OneToOne import java.math.BigDecimal @@ -47,14 +48,14 @@ class Place( // // @OneToMany(mappedBy = "place", fetch = FetchType.LAZY) // val reviews: List = emptyList(), -// -// @OneToMany(mappedBy = "place", fetch = FetchType.LAZY) -// val placeLikes: List = emptyList(), -// + + @OneToMany(mappedBy = "place", fetch = FetchType.LAZY) + val placeLikes: Set, + @OneToOne(mappedBy = "place", fetch = FetchType.LAZY) val openTime: OpenTime, -// -// @OneToMany(mappedBy="place", fetch = FetchType.LAZY) -// val images: List = emptyList(), + + @OneToMany(mappedBy="place", fetch = FetchType.LAZY) + val placeImages: Set ) : BaseEntity() \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceMapResponseDTO.kt b/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceMapResponseDTO.kt index b73a42a..01cb9d6 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceMapResponseDTO.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceMapResponseDTO.kt @@ -1,5 +1,6 @@ package busanVibe.busan.domain.place.dto +import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming @@ -31,6 +32,7 @@ class PlaceMapResponseDTO { val latitude: Double, val longitude: Double, val address: String, + @get:JsonProperty("is_open") val isOpen: Boolean, val imgList: List ) diff --git a/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceResponseDTO.kt b/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceResponseDTO.kt index efc85a6..2c5a120 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceResponseDTO.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceResponseDTO.kt @@ -1,5 +1,6 @@ package busanVibe.busan.domain.place.dto +import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming @@ -17,6 +18,7 @@ class PlaceResponseDTO { val placeId: Long?, val name: String, val congestionLevel: Int, + @get:JsonProperty("is_like") val isLike: Boolean, val likeAmount: Int, val type: String, @@ -34,7 +36,7 @@ class PlaceResponseDTO { abstract val type: String - abstract val img: String? + abstract val img: List? abstract val congestionLevel: Int @@ -44,12 +46,14 @@ class PlaceResponseDTO { abstract val likeAmount: Int + @get:JsonProperty("is_open") abstract val isOpen: Boolean abstract val address: String abstract val phone: String + @get:JsonProperty("is_like") abstract val isLike: Boolean @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) @@ -57,14 +61,16 @@ class PlaceResponseDTO { override val id: Long?, override val name: String, override val type: String, - override val img: String?, + override val img: List, override val congestionLevel: Int, override val grade: Float?, override val reviewAmount: Int, override val likeAmount: Int, + @get:JsonProperty("is_open") override val isOpen: Boolean, override val address: String, override val phone: String, + @get:JsonProperty("is_like") override val isLike: Boolean, val introduce: String ) : PlaceDetailsDto() @@ -74,14 +80,16 @@ class PlaceResponseDTO { override val id: Long?, override val name: String, override val type: String, - override val img: String?, + override val img: List, override val congestionLevel: Int, override val grade: Float?, override val reviewAmount: Int, override val likeAmount: Int, + @get:JsonProperty("is_open") override val isOpen: Boolean, override val address: String, override val phone: String, + @get:JsonProperty("is_like") override val isLike: Boolean, val monOpen: String, val tueOpen: String, diff --git a/src/main/kotlin/busanVibe/busan/domain/place/enums/PlaceType.kt b/src/main/kotlin/busanVibe/busan/domain/place/enums/PlaceType.kt index 721124e..c5b8404 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/enums/PlaceType.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/enums/PlaceType.kt @@ -4,13 +4,14 @@ import lombok.AllArgsConstructor @AllArgsConstructor enum class PlaceType( - val korean: String + val korean: String, + val capitalEnglish: String ) { - ALL("전체"), - SIGHT("관광지"), - RESTAURANT("식당"), - CAFE("카페") + ALL("전체", "ALL"), + SIGHT("관광지", "SIGHT"), + RESTAURANT("식당", "RESTAURANT"), + CAFE("카페", "CAFE") ; diff --git a/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceImageRepository.kt b/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceImageRepository.kt index bb8c56d..52be902 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceImageRepository.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceImageRepository.kt @@ -6,7 +6,6 @@ import org.springframework.data.jpa.repository.JpaRepository interface PlaceImageRepository: JpaRepository { - fun findByPlace(place: Place): List fun findByPlaceIn(placeList: List): List } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceRepository.kt b/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceRepository.kt index 9a5fd55..38e6a54 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceRepository.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/repository/PlaceRepository.kt @@ -19,10 +19,13 @@ interface PlaceRepository: JpaRepository { @Query( """ SELECT p FROM Place p - JOIN FETCH p.openTime + LEFT JOIN FETCH p.placeLikes pl + LEFT JOIN FETCH pl.user + LEFT JOIN FETCH p.placeImages + LEFT JOIN FETCH p.openTime WHERE p.id = :placeId """ ) - fun findPlaceForDetails(@Param("placeId") placeId: Long): Place? + fun findByIdWithLIkeAndImage(@Param("placeId") placeId: Long): Place? } \ No newline at end of file diff --git a/src/main/kotlin/busanVibe/busan/domain/place/service/PlaceQueryService.kt b/src/main/kotlin/busanVibe/busan/domain/place/service/PlaceQueryService.kt index 1ba842f..6fc01d4 100644 --- a/src/main/kotlin/busanVibe/busan/domain/place/service/PlaceQueryService.kt +++ b/src/main/kotlin/busanVibe/busan/domain/place/service/PlaceQueryService.kt @@ -30,7 +30,6 @@ class PlaceQueryService( private val placeImageRepository: PlaceImageRepository, private val reviewRepository: ReviewRepository, private val redisTemplate: StringRedisTemplate, - private val openTimeRepository: OpenTimeRepository, ) { private val redisUtil = PlaceRedisUtil(redisTemplate) @@ -83,7 +82,7 @@ class PlaceQueryService( congestionLevel = congestionMap[placeId] ?: 1, isLike = userLikedPlaceIds.contains(placeId), // 현재 로그인한 사용자 기준 likeAmount = likeCountMap[placeId] ?: 0, // 전체 사용자 기준 - type = place.type.korean, + type = place.type.capitalEnglish, address = place.address, img = placeImages[placeId] ) @@ -106,24 +105,22 @@ class PlaceQueryService( val currentUser: User = AuthService().getCurrentUser() // 관광지일 때는 요일별 오픈시간도 같이 조회 - val place: Place? = placeRepository.findPlaceForDetails(placeId) + log.info(" 명소 + 이미지 + 좋아요 + 오픈시간 조회") + val place: Place? = placeRepository.findByIdWithLIkeAndImage(placeId) + // 검증 place ?: throw ExceptionHandler(ErrorStatus.PLACE_NOT_FOUND) // 필요한 연관관계 객체 리스트 추출 - log.info("장소 좋아요 조회") - val placeLikes: List = placeLikeRepository.findByPlace(place) + val placeLikes: List = place.placeLikes.toList() + val placeImages: List = place.placeImages.toList() + log.info("장소 리뷰 조회") - val placeReviews: List = reviewRepository.findForDetails(place) // 리뷰랑 작성자 Fetch Join - log.info("장소 이미지 조회") - val placeImages: List = placeImageRepository.findByPlace(place) -// log.info("장소 오픈타임 조회") -// val placeOpenTime: OpenTime? = openTimeRepository.findByPlace(place) + val placeReviews: List = reviewRepository.findForDetails(place) // 좋아요 여부 구함 val isLike = placeLikes.any { it.user.id == currentUser.id } if(place.type == PlaceType.SIGHT){ - println("여기1") return placeDetailsConverter.toSightDto( place = place, placeLikes = placeLikes, @@ -133,7 +130,6 @@ class PlaceQueryService( ) } else{ - println("여기2") return placeDetailsConverter.toRestaurantDto( place = place, placeLikes = placeLikes, diff --git a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorReasonDTO.kt b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorReasonDTO.kt index 7c320f6..e7b737a 100644 --- a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorReasonDTO.kt +++ b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorReasonDTO.kt @@ -1,11 +1,16 @@ package busanVibe.busan.global.apiPayload.code +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.PropertyNamingStrategies +import com.fasterxml.jackson.databind.annotation.JsonNaming import lombok.Builder import org.springframework.http.HttpStatus @Builder +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) open class ErrorReasonDTO( val httpStatus: HttpStatus, + @get:JsonProperty("is_success") val isSuccess: Boolean = false, val code: String, val message: String diff --git a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorResponseDTO.kt b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorResponseDTO.kt index 1b7d9c0..4bbf922 100644 --- a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorResponseDTO.kt +++ b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ErrorResponseDTO.kt @@ -1,9 +1,11 @@ package busanVibe.busan.global.apiPayload.code -import busanVibe.busan.global.apiPayload.code.ErrorReasonDTO import busanVibe.busan.global.apiPayload.code.status.ErrorStatus +import com.fasterxml.jackson.databind.PropertyNamingStrategies +import com.fasterxml.jackson.databind.annotation.JsonNaming import org.springframework.http.HttpStatus +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) class ErrorResponseDTO private constructor( httpStatus: HttpStatus, code: String, diff --git a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ReasonDTO.kt b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ReasonDTO.kt index 5ba0438..6e3dd0c 100644 --- a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ReasonDTO.kt +++ b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/ReasonDTO.kt @@ -1,9 +1,14 @@ package busanVibe.busan.global.apiPayload.code +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.PropertyNamingStrategies +import com.fasterxml.jackson.databind.annotation.JsonNaming import org.springframework.http.HttpStatus +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) class ReasonDTO( val httpStatus: HttpStatus?, + @get:JsonProperty("is_success") val isSuccess: Boolean, val code: String, val message: String diff --git a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/status/ErrorStatus.kt b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/status/ErrorStatus.kt index 49db809..e3d357f 100644 --- a/src/main/kotlin/busanVibe/busan/global/apiPayload/code/status/ErrorStatus.kt +++ b/src/main/kotlin/busanVibe/busan/global/apiPayload/code/status/ErrorStatus.kt @@ -24,6 +24,9 @@ enum class ErrorStatus( // 명소 관련 에러 PLACE_NOT_FOUND(HttpStatus.NOT_FOUND, "PLACE4004", "명소를 찾을 수 없습니다."), + // 축제 관련 에러 + FESTIVAL_NOT_FOUND(HttpStatus.NOT_FOUND, "FESTIVAL4004", "축제를 찾을 수 없습니다."), + // 인증 관련 에러 AUTHENTICATION_FAILED(HttpStatus.UNAUTHORIZED, "AUTH4010", "인증에 실패했습니다."); diff --git a/src/main/kotlin/busanVibe/busan/global/apiPayload/exception/ApiResponse.kt b/src/main/kotlin/busanVibe/busan/global/apiPayload/exception/ApiResponse.kt index 27f8f37..5a3d023 100644 --- a/src/main/kotlin/busanVibe/busan/global/apiPayload/exception/ApiResponse.kt +++ b/src/main/kotlin/busanVibe/busan/global/apiPayload/exception/ApiResponse.kt @@ -11,9 +11,9 @@ import lombok.Getter @Getter @AllArgsConstructor -@JsonPropertyOrder("isSuccess", "code", "message", "result") +@JsonPropertyOrder("is_success", "code", "message", "result") class ApiResponse( - @JsonProperty("is_success") + @get:JsonProperty("is_success") val isSuccess: Boolean, val code: String, val message: String,