Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/discord.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
env:
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
# 개인 토큰 필요 시 아래 주석 해제 후 secrets에 등록
# GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
# PAT_TOKEN: ${{ secrets.PAT_TOKEN }}

steps:
- name: Get PR number
Expand All @@ -29,23 +29,27 @@ jobs:
echo "$COMMITS_JSON" > commits.json

COMMITS_COUNT=$(echo "$COMMITS_JSON" | jq 'length')
COMMITS_MSG=$(echo "$COMMITS_JSON" | jq -r '[.[] | {sha: .sha[:7], url: .html_url, message: .commit.message}] | map("- [\(.sha)](\(.url)) \(.message)") | join("\n")')
COMMITS_MSG=$(echo "$COMMITS_JSON" | jq -r '[.[] | "- [" + (.sha[:7]) + "](" + .html_url + ") " + .commit.message] | join("\n")')

echo "COMMITS_COUNT=$COMMITS_COUNT" >> $GITHUB_ENV
echo "COMMITS_MSG<<EOF" >> $GITHUB_ENV
echo "$COMMITS_MSG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV


- name: Send Discord notification
run: |
USERNAME="${{ github.actor }}"
NOW=$(date '+%Y-%m-%d %H:%M')

# JSON 문자열을 jq로 안전하게 생성
JSON_PAYLOAD=$(jq -n --arg content "🚀 **배포 완료** (main 브랜치)\n\n배포자: @$USERNAME\n커밋 $COMMITS_COUNT개 포함\n배포 시간: $NOW\n\n커밋 내역:\n$COMMITS_MSG" '{content: $content}')


JSON_PAYLOAD=$(jq -n --arg content "🚀 **배포 완료** (main 브랜치)

배포자: @$USERNAME
커밋 $COMMITS_COUNT개 포함
배포 시간: $NOW

커밋 내역:
$COMMITS_MSG" '{content: $content}')

curl -H "Content-Type: application/json" \
-X POST \
-d "$JSON_PAYLOAD" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController

@Tag(name = "채팅 관련 API")
@RestController
@RequestMapping("/chat")
@RequestMapping("/api/chat")
class ChatRestController(
private val chatMongoService: ChatMongoService,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class FestivalConverter {
fun toInfoDto(festival: Festival, festivalImageMap: Map<Long, String>, userLikedFestivalIdList: Set<Long>, likeCountMap: Map<Long, Int>): FestivalListResponseDTO.FestivalInfoDto {
val festivalId = festival.id!!
return FestivalListResponseDTO.FestivalInfoDto(
festivalId = festival.id,
id = festival.id,
name = festival.name,
img = festivalImageMap[festivalId],
startDate = convertFestivalDate(festival.startDate),
endDate = convertFestivalDate(festival.endDate),
address = festival.place,
isLike = userLikedFestivalIdList.contains(festivalId),
likeCount = likeCountMap[festivalId] ?: 0,
likeAmount = likeCountMap[festivalId] ?: 0,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FestivalDetailsDTO {
val id: Long,
val img: Set<String>,
val name: String,
val likeCount: Int,
val likeAmount: Int,
@get:JsonProperty("is_like")
val isLike: Boolean,
val startDate: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class FestivalListResponseDTO {

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class FestivalInfoDto(
val festivalId: Long,
val id: Long,
val name: String,
val img: String?,
val startDate: String,
val endDate: String,
val address: String,
@get:JsonProperty("is_like")
val isLike: Boolean,
val likeCount: Int,
val likeAmount: Int,
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class FestivalQueryService(
FestivalSortType.DEFAULT -> dtoList
FestivalSortType.START -> dtoList.sortedBy { it.startDate }
FestivalSortType.END -> dtoList.sortedBy { it.endDate }
FestivalSortType.LIKE -> dtoList.sortedByDescending { it.likeCount }
FestivalSortType.LIKE -> dtoList.sortedByDescending { it.likeAmount }
}

return FestivalListResponseDTO.ListDto(sortedList)
Expand Down Expand Up @@ -112,7 +112,7 @@ class FestivalQueryService(
id = festivalId,
img = imgUrlSet,
name = festival.name,
likeCount = likeList.size,
likeAmount = likeList.size,
isLike = likeList.any { it.user.id == currentUser.id },
startDate = FestivalConverter().convertFestivalDate(festival.startDate),
endDate = FestivalConverter().convertFestivalDate(festival.endDate),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class HomeResponseDTO {

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class MostCongestion(
val placeId: Long?,
val id: Long?,
val name: String,
val latitude: Double? = null,
val longitude: Double? = null,
Expand All @@ -26,7 +26,7 @@ class HomeResponseDTO {

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class RecommendPlace(
val placeId: Long?,
val id: Long?,
val name: String,
val congestionLevel: Int,
val type: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class HomeQueryService(

return top5.map { (place, congestion) ->
HomeResponseDTO.MostCongestion(
placeId = place.id,
id = place.id,
name = place.name,
latitude = place.latitude?.toDouble(),
longitude = place.longitude?.toDouble(),
Expand All @@ -66,7 +66,7 @@ class HomeQueryService(
val congestion = placeRedisUtil.getRedisCongestion(place.id)

HomeResponseDTO.RecommendPlace(
placeId = place.id,
id = place.id,
name = place.name,
congestionLevel = congestion,
type = place.type.korean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,16 @@ class PlaceController(
}

@GetMapping("/{placeId}")
@Operation(summary = "명소 상세 조회")
@Operation(summary = "명소 상세 조회",
description =
"""
명소 상세 조회 API 입니다. 타입 구분 없이 API 응답 형태가 동일합니다.
응답 값 중 type 응답 종류
- 'SIGHT'
- 'RESTAURANT'
- 'CULTURE'
"""
)
fun getPlaceDetails(@PathVariable("placeId") placeId: Long) : ApiResponse<PlaceResponseDTO.PlaceDetailsDto>?
{
val placeDetail: PlaceResponseDTO.PlaceDetailsDto = placeQueryService.getPlaceDetails(placeId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,55 +43,57 @@ class PlaceDetailsConverter(
isLike = isLike,
phone = place.phone,
introduce = place.introduction,
isOpen = true // TODO: 실제 오픈 여부 판단
isOpen = true, // TODO: 실제 오픈 여부 판단
useTime = place.useTime,
restDate = place.restDate,
)

// 맛집 DTO 변환
fun toRestaurantDto(
place: Place,
placeLikes: List<PlaceLike>,
placeReviews: List<Review>,
placeImages: List<PlaceImage>,
placeOpenTime: OpenTime?,
isLike: Boolean
): PlaceResponseDTO.PlaceDetailsDto.RestaurantDto = PlaceResponseDTO.PlaceDetailsDto.RestaurantDto(
id = place.id,
name = place.name,
type = place.type.capitalEnglish,
img = placeImages.map { it.imgUrl },
congestionLevel = redisUtil.getRedisCongestion(place.id),
grade = placeReviews.map { it.score }.average().toFloat(),
reviewAmount = placeReviews.size,
likeAmount = placeLikes.size,
address = place.address,
isLike = isLike,
phone = place.phone,
monOpen = placeOpenTime?.monOpen.toTimeString(),
tueOpen = placeOpenTime?.tueOpen.toTimeString(),
wedOpen = placeOpenTime?.wedOpen.toTimeString(),
thuOpen = placeOpenTime?.thuOpen.toTimeString(),
friOpen = placeOpenTime?.friOpen.toTimeString(),
satOpen = placeOpenTime?.satOpen.toTimeString(),
sunOpen = placeOpenTime?.sunOpen.toTimeString(),
monClose = placeOpenTime?.monClose.toTimeString(),
tueClose = placeOpenTime?.tueClose.toTimeString(),
wedClose = placeOpenTime?.wedClose.toTimeString(),
thuClose = placeOpenTime?.thuClose.toTimeString(),
friClose = placeOpenTime?.friClose.toTimeString(),
satClose = placeOpenTime?.satClose.toTimeString(),
sunClose = placeOpenTime?.sunClose.toTimeString(),
review = toReviewDtoList(placeReviews),
isOpen = true // TODO: 실제 오픈 여부 판단
)

private fun toReviewDtoList(reviews: List<Review>): List<PlaceResponseDTO.ReviewDto> =
reviews.map {
PlaceResponseDTO.ReviewDto(
usrName = it.user.nickname,
usrImg = it.user.profileImageUrl,
grade = it.score,
date = it.createdAt.toString(),
content = it.content
)
}
// // 맛집 DTO 변환
// fun toRestaurantDto(
// place: Place,
// placeLikes: List<PlaceLike>,
// placeReviews: List<Review>,
// placeImages: List<PlaceImage>,
// placeOpenTime: OpenTime?,
// isLike: Boolean
// ): PlaceResponseDTO.PlaceDetailsDto.RestaurantDto = PlaceResponseDTO.PlaceDetailsDto.RestaurantDto(
// id = place.id,
// name = place.name,
// type = place.type.capitalEnglish,
// img = placeImages.map { it.imgUrl },
// congestionLevel = redisUtil.getRedisCongestion(place.id),
// grade = placeReviews.map { it.score }.average().toFloat(),
// reviewAmount = placeReviews.size,
// likeAmount = placeLikes.size,
// address = place.address,
// isLike = isLike,
// phone = place.phone,
// monOpen = placeOpenTime?.monOpen.toTimeString(),
// tueOpen = placeOpenTime?.tueOpen.toTimeString(),
// wedOpen = placeOpenTime?.wedOpen.toTimeString(),
// thuOpen = placeOpenTime?.thuOpen.toTimeString(),
// friOpen = placeOpenTime?.friOpen.toTimeString(),
// satOpen = placeOpenTime?.satOpen.toTimeString(),
// sunOpen = placeOpenTime?.sunOpen.toTimeString(),
// monClose = placeOpenTime?.monClose.toTimeString(),
// tueClose = placeOpenTime?.tueClose.toTimeString(),
// wedClose = placeOpenTime?.wedClose.toTimeString(),
// thuClose = placeOpenTime?.thuClose.toTimeString(),
// friClose = placeOpenTime?.friClose.toTimeString(),
// satClose = placeOpenTime?.satClose.toTimeString(),
// sunClose = placeOpenTime?.sunClose.toTimeString(),
// review = toReviewDtoList(placeReviews),
// isOpen = true // TODO: 실제 오픈 여부 판단
// )
//
// private fun toReviewDtoList(reviews: List<Review>): List<PlaceResponseDTO.ReviewDto> =
// reviews.map {
// PlaceResponseDTO.ReviewDto(
// usrName = it.user.nickname,
// usrImg = it.user.profileImageUrl,
// grade = it.score,
// date = it.createdAt.toString(),
// content = it.content
// )
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PlaceMapResponseDTO {

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class PlaceMapInfoDto(
val placeId: Long?,
val id: Long?,
val name: String,
val type: String,
val congestionLevel: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PlaceResponseDTO {

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class PlaceListInfoDto(
val placeId: Long?,
val id: Long?,
val name: String,
val congestionLevel: Int,
@get:JsonProperty("is_like")
Expand Down Expand Up @@ -72,50 +72,52 @@ class PlaceResponseDTO {
override val phone: String,
@get:JsonProperty("is_like")
override val isLike: Boolean,
val introduce: String
val introduce: String,
val useTime: String,
val restDate: String
) : PlaceDetailsDto()

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class RestaurantDto(
override val id: Long?,
override val name: String,
override val type: String,
override val img: List<String>,
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,
val wedOpen: String,
val thuOpen: String,
val friOpen: String,
val satOpen: String,
val sunOpen: String,
val monClose: String,
val tueClose: String,
val wedClose: String,
val thuClose: String,
val friClose: String,
val satClose: String,
val sunClose: String,
val review: List<ReviewDto>
) : PlaceDetailsDto()
// @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
// data class RestaurantDto(
// override val id: Long?,
// override val name: String,
// override val type: String,
// override val img: List<String>,
// 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,
// val wedOpen: String,
// val thuOpen: String,
// val friOpen: String,
// val satOpen: String,
// val sunOpen: String,
// val monClose: String,
// val tueClose: String,
// val wedClose: String,
// val thuClose: String,
// val friClose: String,
// val satClose: String,
// val sunClose: String,
// val review: List<ReviewDto>
// ) : PlaceDetailsDto()
}

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
data class ReviewDto(
val usrImg: String?,
val usrName: String,
val grade: Float,
val date: String,
val content: String
)
// @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class)
// data class ReviewDto(
// val usrImg: String?,
// val usrName: String,
// val grade: Float,
// val date: String,
// val content: String
// )

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PlaceCongestionQueryService(
// DTO 변환
val placeDtoList :List<PlaceMapResponseDTO.PlaceMapInfoDto> = placeList.map {
PlaceMapResponseDTO.PlaceMapInfoDto(
placeId = it.id,
id = it.id,
name = it.name,
type = it.type.capitalEnglish,
latitude = it.latitude,
Expand Down
Loading