Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix | #81 | @YongsHub | v1.0.1 출시 위해 Rest Docs 업데이트 및 프로필 조회 nullable 허용 #89

Merged
merged 3 commits into from
Feb 29, 2024
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
3 changes: 3 additions & 0 deletions lovebird-api/src/docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
| `8000`
| 잘못된 파라미터 입니다.

| `8001`
| 허용되지 않은 메소드 입니다..

| `9998`
| 내부 서버 에러 입니다.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class GlobalControllerAdvice {
@ExceptionHandler(
value = [
HttpMessageNotReadableException::class,
HttpRequestMethodNotSupportedException::class,
MissingServletRequestParameterException::class,
MethodArgumentTypeMismatchException::class
]
Expand All @@ -40,6 +39,13 @@ class GlobalControllerAdvice {
.body(ApiResponse.fail(ReturnCode.WRONG_PARAMETER))
}

@ExceptionHandler(HttpRequestMethodNotSupportedException::class)
fun handleMethodNotSupportedException(e: HttpRequestMethodNotSupportedException): ResponseEntity<ApiResponse<Unit>> {
return ResponseEntity
.status(HttpStatus.METHOD_NOT_ALLOWED)
.body(ApiResponse.fail(ReturnCode.METHOD_NOT_ALLOWED))
}

@ExceptionHandler(MethodArgumentNotValidException::class)
fun badRequestExHandler(bindingResult: BindingResult): ResponseEntity<ApiResponse<*>> {
return ResponseEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ data class ProfileDetailResponse(
val partnerBirthday: LocalDate?,
val dayCount: Long?,
val nextAnniversary: AnniversaryResponse?,
val profileImageUrl: String,
val profileImageUrl: String?,
val partnerImageUrl: String?
) {
companion object {
Expand Down
16 changes: 7 additions & 9 deletions lovebird-api/src/main/resources/static/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ <h2 id="overview_Lovebird_response_rule"><a class="link" href="#overview_Lovebir
<td class="tableblock halign-left valign-top"><p class="tableblock">잘못된 파라미터 입니다.</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>8001</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">허용되지 않은 메소드 입니다..</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>9998</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">내부 서버 에러 입니다.</p></td>
</tr>
Expand Down Expand Up @@ -3168,16 +3172,10 @@ <h4 id="_success_10"><a class="link" href="#_success_10">8.2.1. <code>Success</c
<h5 id="_success_10_http_request"><a class="link" href="#_success_10_http_request">HTTP request</a></h5>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">GET /api/v1/calendars HTTP/1.1
<pre class="highlightjs highlight nowrap"><code class="language-http hljs" data-lang="http">GET /api/v1/calendars?year=2024&amp;month=1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer access-token
Content-Length: 35
Host: localhost:8080

{
"year" : 2023,
"month" : 12
}</code></pre>
Host: localhost:8080</code></pre>
</div>
</div>
</div>
Expand Down Expand Up @@ -4585,7 +4583,7 @@ <h4 id="_다이어리_삭제_response_fields"><a class="link" href="#_다이어
<div id="footer">
<div id="footer-text">
Version 1.0.2-SNAPSHOT<br>
Last updated 2024-02-12 13:10:39 +0900
Last updated 2024-02-29 13:58:42 +0900
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.3/highlight.min.js"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ class CalendarControllerTest(
}

describe("GET: /api/v1/calendars") {
val url = "$baseUrl?year=2024&month=1"
context("year 또는 month 기준으로 캘린더 목록을 요청하면") {
val requestBody = getCalendarListRequest()
val requestJson = toJson(requestBody)
val request = request(HttpMethod.GET, baseUrl)
val request = request(HttpMethod.GET, url)
.header(HttpHeaders.AUTHORIZATION, "Bearer access-token")
.contentType(MediaType.APPLICATION_JSON)
.content(requestJson)

val user = ServiceDescribeSpec.getUser(1L)
val calendarList = CalendarServiceTest.getCalendarList(requestBody.toParam(user), null)
val response = CalendarListResponse.of(calendarList)
Expand All @@ -99,10 +99,6 @@ class CalendarControllerTest(
requestHeaders(
"Authorization" headerMeans "액세스 토큰"
),
requestBody(
"year" type NUMBER means "년도(Year)",
"month" type NUMBER means "월(Month)"
),
envelopeResponseBody(
"data.calendars" type ARRAY means "캘린더 목록",
"data.totalCount" type NUMBER means "캘린더 개수"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ProfileControllerTest(
jsonPath("$.data.nextAnniversary.kind") shouldBe response.nextAnniversary!!.kind.toString(),
jsonPath("$.data.nextAnniversary.seq") shouldBe response.nextAnniversary!!.seq.toString(),
jsonPath("$.data.nextAnniversary.anniversaryDate") shouldBe response.nextAnniversary!!.anniversaryDate.toString(),
jsonPath("$.data.profileImageUrl") shouldBe response.profileImageUrl,
jsonPath("$.data.profileImageUrl") shouldBe response.profileImageUrl!!,
jsonPath("$.data.partnerImageUrl") shouldBe response.partnerImageUrl!!
)
.andDocument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum class ReturnCode(val code: String, val message: String) {

// 클라이언트 에러
WRONG_PARAMETER("8000", "잘못된 파라미터 입니다."),
METHOD_NOT_ALLOWED("8001", "허용되지 않은 메소드 입니다."),

// 서버 에러
INTERNAL_SERVER_ERROR("9998", "내부 서버 에러 입니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ data class ProfileDetailResponseParam(
val firstDate: LocalDate?,
val birthday: LocalDate?,
val partnerBirthday: LocalDate?,
val profileImageUrl: String,
val profileImageUrl: String?,
val partnerImageUrl: String?
) {
companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ data class ProfileUserResponseParam @QueryProjection constructor(
val nickname: String,
val firstDate: LocalDate?,
val birthday: LocalDate?,
val profileImageUrl: String
val profileImageUrl: String?
)
Loading