From c993d01fb9ff5479e921adfa17ff333c5f1a9ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Sat, 31 Aug 2024 02:16:43 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[fix][#94]=EC=B5=9C=EC=8B=A0=EC=88=9C=20?= =?UTF-8?q?=EB=B2=84=EA=B7=B8=20=ED=94=BD=EC=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/bbo_gak/domain/recruit/dao/RecruitRepository.java | 2 +- .../server/bbo_gak/domain/recruit/service/RecruitService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/dao/RecruitRepository.java b/src/main/java/com/server/bbo_gak/domain/recruit/dao/RecruitRepository.java index ae708ff..8a5fcad 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/dao/RecruitRepository.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/dao/RecruitRepository.java @@ -14,5 +14,5 @@ public interface RecruitRepository extends JpaRepository { List findAllByUserIdAndSeason(Long userId, Season season); - List findTop5ByUserIdOrderByCreatedDateAsc(Long userId); + List findTop5ByUserIdOrderByCreatedDateDesc(Long userId); } diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java b/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java index 99267b8..fa5722a 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java @@ -48,7 +48,7 @@ public List getRecruitListBySeason(User user, String seasonN } public List getRecruitRecent5TitleList(User user) { - return recruitRepository.findTop5ByUserIdOrderByCreatedDateAsc(user.getId()) + return recruitRepository.findTop5ByUserIdOrderByCreatedDateDesc(user.getId()) .stream() .map(RecruitGetTitleListResponse::from) .toList(); From 64820b15dd2737c3a50f047aaf41f8a3317ed05c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Sat, 31 Aug 2024 03:30:28 +0900 Subject: [PATCH 2/6] merge main --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index a4be7d4..70cb74f 100644 --- a/build.gradle +++ b/build.gradle @@ -114,7 +114,7 @@ bootJar { } openapi3 { - server = "https://dev.bbogak.com" + server = System.getenv('API_SERVER_URL') ?: "http://localhost:8080" title = "뽀각 API 문서" description = "뽀각 API 문서입니다." version = "0.0.1" @@ -123,5 +123,4 @@ openapi3 { // /static/docs/open-api-3.0.1.json 생성 → jar 파일만 배포할 예정이기에 build 에 출력 outputDirectory = 'build/resources/main/static/docs' -} - +} \ No newline at end of file From cf3cc14b9a0ac0fd6483c3680bdc160ac66f88bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Sat, 31 Aug 2024 03:50:12 +0900 Subject: [PATCH 3/6] merge main --- .../com/server/bbo_gak/global/error/exception/ErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java b/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java index 7ac36a6..d2ab47e 100644 --- a/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java +++ b/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java @@ -66,7 +66,7 @@ public enum ErrorCode { CARD_TAG_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 카드와 태그 매핑을 찾을 수 없습니다"), //CardMemo - CARD_MEMO_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 카드를 찾을 수 없습니다"); + CARD_MEMO_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 카드 메모를 찾을 수 없습니다"); private final HttpStatus status; From f9941a902dee03f232d53608a819bc1919727da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Sat, 31 Aug 2024 04:35:25 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[feat][#9]=20logback=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 ++ src/main/resources/logback-spring.xml | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/main/resources/logback-spring.xml diff --git a/build.gradle b/build.gradle index 70cb74f..537d25d 100644 --- a/build.gradle +++ b/build.gradle @@ -66,6 +66,8 @@ dependencies { annotationProcessor "jakarta.annotation:jakarta.annotation-api" annotationProcessor "jakarta.persistence:jakarta.persistence-api" + implementation 'net.logstash.logback:logstash-logback-encoder:7.4' + //s3 implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE' diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..7694557 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,18 @@ + + + + dev.bbogak.com:5000 + + + + + + + + + + + + + + From a34f6a1023da56cc29c3392551c3cfa7da40efb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Sat, 31 Aug 2024 13:55:38 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[fix][#9]logback=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback-spring.xml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/main/resources/logback-spring.xml diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml deleted file mode 100644 index 7694557..0000000 --- a/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - dev.bbogak.com:5000 - - - - - - - - - - - - - - From 63536e91408e0fbe4bdbe706b255faf72b2ec967 Mon Sep 17 00:00:00 2001 From: Byuk_mm Date: Sat, 31 Aug 2024 14:40:42 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[hotfix]=20=EB=A9=B4=EC=A0=91=20=EC=A4=80?= =?UTF-8?q?=EB=B9=84=20=EB=B3=80=EA=B2=BD=20revert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthControllerTest.java | 95 ++++++++++--------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/src/test/java/com/server/bbo_gak/domain/auth/controller/AuthControllerTest.java b/src/test/java/com/server/bbo_gak/domain/auth/controller/AuthControllerTest.java index 0c28d78..6a6326b 100644 --- a/src/test/java/com/server/bbo_gak/domain/auth/controller/AuthControllerTest.java +++ b/src/test/java/com/server/bbo_gak/domain/auth/controller/AuthControllerTest.java @@ -1,11 +1,11 @@ package com.server.bbo_gak.domain.auth.controller; -import static com.server.bbo_gak.global.security.jwt.service.JwtTokenService.TOKEN_ROLE_NAME; -import static org.junit.jupiter.api.Assertions.assertTrue; import static com.epages.restdocs.apispec.MockMvcRestDocumentationWrapper.document; import static com.epages.restdocs.apispec.ResourceDocumentation.parameterWithName; import static com.epages.restdocs.apispec.ResourceDocumentation.resource; +import static com.server.bbo_gak.global.security.jwt.service.JwtTokenService.TOKEN_ROLE_NAME; import static org.hamcrest.Matchers.matchesPattern; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.when; import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; @@ -20,10 +20,10 @@ import com.epages.restdocs.apispec.ResourceSnippetParameters; import com.server.bbo_gak.domain.auth.dto.request.LoginRequest; +import com.server.bbo_gak.domain.auth.dto.request.RefreshTokenRequest; import com.server.bbo_gak.domain.auth.dto.response.oauth.OauthUserInfoResponse; import com.server.bbo_gak.domain.auth.service.oauth.GoogleService; import com.server.bbo_gak.domain.user.entity.OauthProvider; -import com.server.bbo_gak.domain.auth.dto.request.RefreshTokenRequest; import com.server.bbo_gak.domain.user.entity.UserRole; import com.server.bbo_gak.global.AbstractRestDocsTests; import com.server.bbo_gak.global.RestDocsFactory; @@ -42,8 +42,8 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; -import org.springframework.test.annotation.Rollback; import org.springframework.http.MediaType; +import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.jdbc.Sql; import org.springframework.transaction.annotation.Transactional; @@ -89,6 +89,7 @@ void setUp() { .signWith(Keys.hmacShaKeyFor(jwtRTSecret.getBytes()), SignatureAlgorithm.HS256) .setIssuer(issuer) .compact(); + } @Nested @@ -101,53 +102,53 @@ class 소셜_로그인 { OauthProvider provider = OauthProvider.GOOGLE; //구글 서비스 모킹 OauthUserInfoResponse mockOauthUserInfoResponse = OauthUserInfoResponse.builder() - .oauthId("oauthId") - .email("email") - .name("name") - .provider(provider) - .build(); + .oauthId("oauthId") + .email("email") + .name("name") + .provider(provider) + .build(); when(googleService.getOauthUserInfo(socialAccessToken)).thenReturn(mockOauthUserInfoResponse); //when mockMvc.perform(post("/api/v1/users/social-login") - .header("SOCIAL-AUTH-TOKEN", socialAccessToken) - .queryParam("provider", provider.name()) - .contentType(MediaType.APPLICATION_JSON) - .accept(MediaType.APPLICATION_JSON)) - - //then - // Verifying HTTP request matching - .andExpect(status().isOk()) - // 헤더 검증 - requestBody의 content-type - .andExpect( - header().string(HttpHeaders.CONTENT_TYPE, matchesPattern("application/json(;charset=UTF-8)?"))) - // Verifying output serialization - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.accessToken").isNotEmpty()) // accessToken 존재 검증 - .andExpect(jsonPath("$.refreshToken").isNotEmpty()) // refreshToken 존재 검증 - - // RestDocs 문서 - .andDo(document("[소셜 로그인] 성공", - preprocessRequest(prettyPrint()), - preprocessResponse(prettyPrint()), - resource( - ResourceSnippetParameters.builder() - .tags("auth") // API 문서의 태그 - .description("소셜로그인 - jwt 토큰 생성") // API 문서의 설명 - .requestHeaders( - headerWithName("SOCIAL-AUTH-TOKEN").description( - "소셜 엑세스 토큰") - ) - .queryParameters( - parameterWithName("provider").description("OAuth provider(ex) GOOGLE)") - ) - .responseFields( // 응답 필드 - fieldWithPath("accessToken").description("accessToken"), - fieldWithPath("refreshToken").description("refreshToken"), - fieldWithPath("isFirstLogin").description("isFirstLogin") - ) - .build() - ))); + .header("SOCIAL-AUTH-TOKEN", socialAccessToken) + .queryParam("provider", provider.name()) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON)) + + //then + // Verifying HTTP request matching + .andExpect(status().isOk()) + // 헤더 검증 - requestBody의 content-type + .andExpect( + header().string(HttpHeaders.CONTENT_TYPE, matchesPattern("application/json(;charset=UTF-8)?"))) + // Verifying output serialization + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.accessToken").isNotEmpty()) // accessToken 존재 검증 + .andExpect(jsonPath("$.refreshToken").isNotEmpty()) // refreshToken 존재 검증 + + // RestDocs 문서 + .andDo(document("[소셜 로그인] 성공", + preprocessRequest(prettyPrint()), + preprocessResponse(prettyPrint()), + resource( + ResourceSnippetParameters.builder() + .tags("auth") // API 문서의 태그 + .description("소셜로그인 - jwt 토큰 생성") // API 문서의 설명 + .requestHeaders( + headerWithName("SOCIAL-AUTH-TOKEN").description( + "소셜 엑세스 토큰") + ) + .queryParameters( + parameterWithName("provider").description("OAuth provider(ex) GOOGLE)") + ) + .responseFields( // 응답 필드 + fieldWithPath("accessToken").description("accessToken"), + fieldWithPath("refreshToken").description("refreshToken"), + fieldWithPath("isFirstLogin").description("isFirstLogin") + ) + .build() + ))); }