From 0a8dd253639ebfa0c7018d481936692ecbe7c55c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B8=B0=EC=84=9C?= <81108344+rlarltj@users.noreply.github.com> Date: Sat, 31 Aug 2024 17:40:21 +0900 Subject: [PATCH] release: deploy to prod (#14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 소속 삭제 api를 구현한다. * chore: mysql volume 경로 변경 * feat: LetsEncrypt 인증서 설치가 가능하도록한다. * chore: Security 설정을 되돌린다. * feat: University 정보를 nullable하게 변경한다. * feat: login api에 schoolInfoProvided 필드를 추가한다. * feat: 대학 정보 update field도 nullable하게 변경한다. * chore: grade를 wrapper class로 변경한다. * chore: ledger 삭제하는 코드를 주석 처리한다. --------- --- .docker/docker-compose.yml | 2 +- .../domain/agency/service/AgencyService.java | 2 +- .../user/api/UserUniversityController.java | 5 ++--- .../request/CreateUserUniversityRequest.java | 10 ++-------- .../request/UpdateUserUniversityRequest.java | 7 ------- .../api/response/LoginSuccessResponse.java | 20 +++++++++++++------ .../api/response/UserProfileResponse.java | 2 +- .../api/response/UserUniversityResponse.java | 4 ++-- .../domain/user/entity/UserUniversity.java | 16 +++++---------- .../user/service/UserFacadeService.java | 8 +++++++- .../config/security/SecurityConfig.java | 3 ++- 11 files changed, 37 insertions(+), 42 deletions(-) diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index 457a03d..4309c22 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -11,7 +11,7 @@ services: ports: - ${DOCKER_DB_PORT} volumes: - - ./mysqldata:/var/lib/mysql2 + - ./mysqldata:/var/lib/mysql restart: always server: diff --git a/src/main/java/com/moneymong/domain/agency/service/AgencyService.java b/src/main/java/com/moneymong/domain/agency/service/AgencyService.java index 02d90d1..0cbda14 100644 --- a/src/main/java/com/moneymong/domain/agency/service/AgencyService.java +++ b/src/main/java/com/moneymong/domain/agency/service/AgencyService.java @@ -142,7 +142,7 @@ public void delete(Long userId, Long agencyId) { Agency agency = agencyRepository.findById(agencyId) .orElseThrow(() -> new NotFoundException(ErrorCode.AGENCY_NOT_FOUND)); - ledgerService.deleteLedger(agencyId); + // ledgerService.deleteLedger(agencyId); agencyRepository.delete(agency); } diff --git a/src/main/java/com/moneymong/domain/user/api/UserUniversityController.java b/src/main/java/com/moneymong/domain/user/api/UserUniversityController.java index 1e284a5..029b2c9 100644 --- a/src/main/java/com/moneymong/domain/user/api/UserUniversityController.java +++ b/src/main/java/com/moneymong/domain/user/api/UserUniversityController.java @@ -7,7 +7,6 @@ import com.moneymong.global.security.token.dto.jwt.JwtAuthentication; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.*; @@ -31,7 +30,7 @@ public UserUniversityResponse getUserUniversity( @PostMapping public void createUserUniversity( @AuthenticationPrincipal JwtAuthentication user, - @RequestBody @Valid CreateUserUniversityRequest request + @RequestBody CreateUserUniversityRequest request ) { userUniversityService.create(user.getId(), request); } @@ -40,7 +39,7 @@ public void createUserUniversity( @PatchMapping public void updateUserUniversity( @AuthenticationPrincipal JwtAuthentication user, - @RequestBody @Valid UpdateUserUniversityRequest request + @RequestBody UpdateUserUniversityRequest request ) { userUniversityService.update(user.getId(), request); } diff --git a/src/main/java/com/moneymong/domain/user/api/request/CreateUserUniversityRequest.java b/src/main/java/com/moneymong/domain/user/api/request/CreateUserUniversityRequest.java index 53e9128..34eefaa 100644 --- a/src/main/java/com/moneymong/domain/user/api/request/CreateUserUniversityRequest.java +++ b/src/main/java/com/moneymong/domain/user/api/request/CreateUserUniversityRequest.java @@ -1,8 +1,5 @@ package com.moneymong.domain.user.api.request; -import jakarta.validation.constraints.Max; -import jakarta.validation.constraints.Min; -import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -11,10 +8,7 @@ @NoArgsConstructor @AllArgsConstructor public class CreateUserUniversityRequest { - @NotBlank - private String universityName; - @Min(value = 1) - @Max(value = 5) - private int grade; + private String universityName; + private Integer grade; } diff --git a/src/main/java/com/moneymong/domain/user/api/request/UpdateUserUniversityRequest.java b/src/main/java/com/moneymong/domain/user/api/request/UpdateUserUniversityRequest.java index 33ccff7..8e364f5 100644 --- a/src/main/java/com/moneymong/domain/user/api/request/UpdateUserUniversityRequest.java +++ b/src/main/java/com/moneymong/domain/user/api/request/UpdateUserUniversityRequest.java @@ -1,8 +1,5 @@ package com.moneymong.domain.user.api.request; -import jakarta.validation.constraints.Max; -import jakarta.validation.constraints.Min; -import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -11,10 +8,6 @@ @NoArgsConstructor @AllArgsConstructor public class UpdateUserUniversityRequest { - @NotBlank private String universityName; - - @Min(value = 1) - @Max(value = 5) private int grade; } diff --git a/src/main/java/com/moneymong/domain/user/api/response/LoginSuccessResponse.java b/src/main/java/com/moneymong/domain/user/api/response/LoginSuccessResponse.java index d7912a1..235661a 100644 --- a/src/main/java/com/moneymong/domain/user/api/response/LoginSuccessResponse.java +++ b/src/main/java/com/moneymong/domain/user/api/response/LoginSuccessResponse.java @@ -12,13 +12,21 @@ public class LoginSuccessResponse { private String refreshToken; private boolean loginSuccess; private boolean schoolInfoExist; + private boolean schoolInfoProvided; - public static LoginSuccessResponse of(String accessToken, String refreshToken, boolean loginSuccess, boolean schoolInfoExist) { + public static LoginSuccessResponse of( + String accessToken, + String refreshToken, + boolean loginSuccess, + boolean schoolInfoExist, + boolean schoolInfoProvided + ) { return LoginSuccessResponse.builder() - .accessToken(accessToken) - .refreshToken(refreshToken) - .loginSuccess(loginSuccess) - .schoolInfoExist(schoolInfoExist) - .build(); + .accessToken(accessToken) + .refreshToken(refreshToken) + .loginSuccess(loginSuccess) + .schoolInfoExist(schoolInfoExist) + .schoolInfoProvided(schoolInfoProvided) + .build(); } } diff --git a/src/main/java/com/moneymong/domain/user/api/response/UserProfileResponse.java b/src/main/java/com/moneymong/domain/user/api/response/UserProfileResponse.java index dee85d9..5bd20e2 100644 --- a/src/main/java/com/moneymong/domain/user/api/response/UserProfileResponse.java +++ b/src/main/java/com/moneymong/domain/user/api/response/UserProfileResponse.java @@ -15,7 +15,7 @@ public class UserProfileResponse { private String nickname; private String email; private String universityName; - private int grade; + private Integer grade; public static UserProfileResponse from(User user, UserUniversity userUniversity) { return UserProfileResponse.builder() diff --git a/src/main/java/com/moneymong/domain/user/api/response/UserUniversityResponse.java b/src/main/java/com/moneymong/domain/user/api/response/UserUniversityResponse.java index 5278d5f..04f06aa 100644 --- a/src/main/java/com/moneymong/domain/user/api/response/UserUniversityResponse.java +++ b/src/main/java/com/moneymong/domain/user/api/response/UserUniversityResponse.java @@ -9,9 +9,9 @@ @AllArgsConstructor public class UserUniversityResponse { private String universityName; - private int grade; + private Integer grade; - public static UserUniversityResponse of(String universityName, int grade) { + public static UserUniversityResponse of(String universityName, Integer grade) { return UserUniversityResponse.builder() .universityName(universityName) .grade(grade) diff --git a/src/main/java/com/moneymong/domain/user/entity/UserUniversity.java b/src/main/java/com/moneymong/domain/user/entity/UserUniversity.java index 83153ff..984d563 100644 --- a/src/main/java/com/moneymong/domain/user/entity/UserUniversity.java +++ b/src/main/java/com/moneymong/domain/user/entity/UserUniversity.java @@ -11,7 +11,6 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.springframework.util.Assert; import static lombok.AccessLevel.PROTECTED; @@ -36,24 +35,19 @@ public class UserUniversity extends TimeBaseEntity { @Column( name = "university_name", - length = 100, - nullable = false + length = 100 ) private String universityName; - @Column(nullable = false) - private int grade; - - public void update(String universityName, int grade) { - Assert.hasText(universityName, "대학 이름은 필수 입력값입니다."); + @Column + private Integer grade; + public void update(String universityName, Integer grade) { this.universityName = universityName; this.grade = grade; } - public static UserUniversity of(Long userId, String universityName, int grade) { - Assert.hasText(universityName, "대학 이름은 필수 입력값입니다."); - + public static UserUniversity of(Long userId, String universityName, Integer grade) { return UserUniversity.builder() .userId(userId) .universityName(universityName) diff --git a/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java b/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java index 885d6f7..5f90da9 100644 --- a/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java +++ b/src/main/java/com/moneymong/domain/user/service/UserFacadeService.java @@ -34,7 +34,13 @@ public LoginSuccessResponse login(LoginRequest loginRequest) { boolean loginSuccess = true; boolean schoolInfoExists = userUniversityService.exists(registerResult.getUserId()); - return LoginSuccessResponse.of(tokens.getAccessToken(), tokens.getRefreshToken(), loginSuccess, schoolInfoExists); + return LoginSuccessResponse.of( + tokens.getAccessToken(), + tokens.getRefreshToken(), + loginSuccess, + schoolInfoExists, + schoolInfoExists // schoolInfoExists와 동일한 값을 반환하며, 추후 schoolInfoExists 필드를 삭제한다. + ); } @Transactional diff --git a/src/main/java/com/moneymong/global/config/security/SecurityConfig.java b/src/main/java/com/moneymong/global/config/security/SecurityConfig.java index 082dae0..759a99a 100644 --- a/src/main/java/com/moneymong/global/config/security/SecurityConfig.java +++ b/src/main/java/com/moneymong/global/config/security/SecurityConfig.java @@ -58,7 +58,8 @@ public WebSecurityCustomizer webSecurityCustomizer() { "/swagger-config/**", "/webjars/**", "/swagger/**", - "/favicon.ico" + "/favicon.ico", + "/.well-known/**" ); }; }