-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#39 홈화면 관련 mock up API 추가
- Loading branch information
Showing
11 changed files
with
245 additions
and
1 deletion.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/main/kotlin/com/routebox/routebox/controller/notification/NotificationController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.routebox.routebox.controller.notification | ||
|
||
import com.routebox.routebox.controller.notification.dto.GetNotificationHistoryResponse | ||
import com.routebox.routebox.controller.notification.dto.GetUnreadNotificationResponse | ||
import com.routebox.routebox.controller.notification.dto.NotificationHistoryDto | ||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.validation.annotation.Validated | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
import kotlin.random.Random | ||
|
||
@Tag(name = "알림 관련 API") | ||
@RestController | ||
@Validated | ||
@RequestMapping("/api") | ||
class NotificationController { | ||
@Operation( | ||
summary = "알림 내역 조회", | ||
description = "알림 내역 조회", | ||
) | ||
@ApiResponses( | ||
ApiResponse(responseCode = "200"), | ||
) | ||
@GetMapping("/v1/notifications") | ||
fun getNotificationHistory(): GetNotificationHistoryResponse { | ||
val mockData = listOf( | ||
NotificationHistoryDto.from(1, "알림 내용1", "2024-08-04", false), | ||
NotificationHistoryDto.from(2, "알림 내용2", "2024-08-03", false), | ||
NotificationHistoryDto.from(3, "알림 내용3", "2024-08-02", true), | ||
NotificationHistoryDto.from(4, "알림 내용4", "2024-08-02", true), | ||
NotificationHistoryDto.from(5, "알림 내용5", "2024-08-01", true), | ||
NotificationHistoryDto.from(6, "알림 내용6", "2024-08-01", true), | ||
NotificationHistoryDto.from(7, "알림 내용7", "2024-08-01", true), | ||
NotificationHistoryDto.from(8, "알림 내용8", "2024-07-31", true), | ||
NotificationHistoryDto.from(9, "알림 내용9", "2024-07-30", true), | ||
NotificationHistoryDto.from(10, "알림 내용10", "2024-07-20", true), | ||
) | ||
return GetNotificationHistoryResponse.from(mockData) | ||
} | ||
|
||
@Operation( | ||
summary = "안읽은 알림 여부 조회", | ||
description = "안읽은 알림 여부 조회", | ||
) | ||
@ApiResponses( | ||
ApiResponse(responseCode = "200"), | ||
) | ||
@GetMapping("/v1/notifications/unread") | ||
fun checkUnreadNotifications(): GetUnreadNotificationResponse { | ||
val mockData: Boolean = Random.nextBoolean() | ||
return GetUnreadNotificationResponse.from(mockData) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...otlin/com/routebox/routebox/controller/notification/dto/GetNotificationHistoryResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.routebox.routebox.controller.notification.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class GetNotificationHistoryResponse( | ||
@Schema(description = "알림 목록") | ||
val notifications: List<NotificationHistoryDto>, | ||
) { | ||
companion object { | ||
fun from(notifications: List<NotificationHistoryDto>): GetNotificationHistoryResponse = GetNotificationHistoryResponse( | ||
notifications = notifications, | ||
) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...kotlin/com/routebox/routebox/controller/notification/dto/GetUnreadNotificationResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.routebox.routebox.controller.notification.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class GetUnreadNotificationResponse( | ||
@Schema(description = "읽지 않은 알림 존재 여부") | ||
val hasUnreadNotification: Boolean, | ||
) { | ||
companion object { | ||
fun from(hasUnreadNotification: Boolean): GetUnreadNotificationResponse = GetUnreadNotificationResponse( | ||
hasUnreadNotification = hasUnreadNotification, | ||
) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/routebox/routebox/controller/notification/dto/NotificationHistoryDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.routebox.routebox.controller.notification.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class NotificationHistoryDto( | ||
@Schema(description = "알림 ID") | ||
val id: Long, | ||
|
||
@Schema(description = "알림 내용") | ||
val content: String, | ||
|
||
@Schema(description = "알림 생성일자 (yyyy-MM-dd)") | ||
val date: String, | ||
|
||
@Schema(description = "알림 읽음 여부") | ||
val isRead: Boolean, | ||
) { | ||
companion object { | ||
fun from(id: Long, content: String, date: String, isRead: Boolean): NotificationHistoryDto = NotificationHistoryDto( | ||
id = id, | ||
content = content, | ||
date = date, | ||
isRead = isRead, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/kotlin/com/routebox/routebox/controller/route/RouteHomeController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.routebox.routebox.controller.route | ||
|
||
import com.routebox.routebox.controller.route.dto.GetPopularRoutesResponse | ||
import com.routebox.routebox.controller.route.dto.GetRecommendedRoutesResponse | ||
import com.routebox.routebox.controller.route.dto.PopularRouteDto | ||
import com.routebox.routebox.controller.route.dto.RecommendRouteDto | ||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.validation.annotation.Validated | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Tag(name = "홈 - 루트 관련 API") | ||
@RestController | ||
@Validated | ||
@RequestMapping("/api") | ||
class RouteHomeController { | ||
@Operation( | ||
summary = "추천 루트 조회", | ||
description = "추천 루트 조회", | ||
) | ||
@ApiResponses( | ||
ApiResponse(responseCode = "200"), | ||
) | ||
@GetMapping("/v1/routes/recommend") | ||
fun getRecommendedRoutes(): GetRecommendedRoutesResponse { | ||
val comment = "8월엔 여기로 여행 어때요?" | ||
val mockData = listOf( | ||
RecommendRouteDto.from(1, "경주 200% 즐기는 법", "경주 200% 즐기는 법", "https://routebox-resources.s3.ap-northeast-2.amazonaws.com/image/1.jpg"), | ||
RecommendRouteDto.from(2, "대구 먹방 여행", "대구 200% 즐기는 법", "https://routebox-resources.s3.ap-northeast-2.amazonaws.com/image/2.jpg"), | ||
RecommendRouteDto.from(3, "대전 빵 여행", "대전 200% 즐기는 법", "https://routebox-resources.s3.ap-northeast-2.amazonaws.com/image/3.jpg"), | ||
) | ||
return GetRecommendedRoutesResponse.from(comment, mockData) | ||
} | ||
|
||
@Operation( | ||
summary = "인기 루트 조회", | ||
description = "인기 루트 조회", | ||
) | ||
@ApiResponses( | ||
ApiResponse(responseCode = "200"), | ||
) | ||
@GetMapping("/v1/routes/popular") | ||
fun getPopularRoutes(): GetPopularRoutesResponse { | ||
val mockData = listOf( | ||
PopularRouteDto(1, "8월에 꼭 가야하는 장소"), | ||
PopularRouteDto(2, "여자친구에게 칭찬 왕창 받은 데이트 코스"), | ||
PopularRouteDto(3, "친구들과 함께 떠나고 싶은 여행지"), | ||
) | ||
return GetPopularRoutesResponse.from(mockData) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/routebox/routebox/controller/route/dto/GetPopularRoutesResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.routebox.routebox.controller.route.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class GetPopularRoutesResponse( | ||
@Schema(description = "인기 루트 목록") | ||
val routes: List<PopularRouteDto>, | ||
) { | ||
companion object { | ||
fun from(routes: List<PopularRouteDto>): GetPopularRoutesResponse = GetPopularRoutesResponse( | ||
routes = routes, | ||
) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/routebox/routebox/controller/route/dto/GetRecommendedRoutesResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.routebox.routebox.controller.route.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class GetRecommendedRoutesResponse( | ||
@Schema(description = "오늘의 추천루트 문구") | ||
val comment: String, | ||
|
||
@Schema(description = "추천 루트 목록") | ||
val routes: List<RecommendRouteDto>, | ||
) { | ||
companion object { | ||
fun from(comment: String, routes: List<RecommendRouteDto>): GetRecommendedRoutesResponse = GetRecommendedRoutesResponse( | ||
comment = comment, | ||
routes = routes, | ||
) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/routebox/routebox/controller/route/dto/PopularRouteDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.routebox.routebox.controller.route.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class PopularRouteDto( | ||
@Schema(description = "루트 ID") | ||
val id: Long, | ||
|
||
@Schema(description = "루트 이름") | ||
val name: String, | ||
) { | ||
companion object { | ||
fun from(id: Long, name: String): PopularRouteDto = PopularRouteDto( | ||
id = id, | ||
name = name, | ||
) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/routebox/routebox/controller/route/dto/RecommendRouteDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.routebox.routebox.controller.route.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class RecommendRouteDto( | ||
@Schema(description = "루트 ID") | ||
val id: Long, | ||
|
||
@Schema(description = "루트 이름") | ||
val routeName: String, | ||
|
||
@Schema(description = "루트 설명") | ||
val routeDescription: String, | ||
|
||
@Schema(description = "루트 대표 이미지") | ||
val routeImageUrl: String, | ||
) { | ||
companion object { | ||
fun from(id: Long, routeName: String, routeDescription: String, routeImageUrl: String): RecommendRouteDto = RecommendRouteDto( | ||
id = id, | ||
routeName = routeName, | ||
routeDescription = routeDescription, | ||
routeImageUrl = routeImageUrl, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters