Skip to content

Commit

Permalink
release: deploy to prod (#14)
Browse files Browse the repository at this point in the history
* 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 삭제하는 코드를 주석 처리한다.

---------
  • Loading branch information
rlarltj authored Aug 31, 2024
1 parent 348cec7 commit 0a8dd25
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
ports:
- ${DOCKER_DB_PORT}
volumes:
- ./mysqldata:/var/lib/mysql2
- ./mysqldata:/var/lib/mysql
restart: always

server:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,10 +8,6 @@
@NoArgsConstructor
@AllArgsConstructor
public class UpdateUserUniversityRequest {
@NotBlank
private String universityName;

@Min(value = 1)
@Max(value = 5)
private int grade;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
16 changes: 5 additions & 11 deletions src/main/java/com/moneymong/domain/user/entity/UserUniversity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.util.Assert;

import static lombok.AccessLevel.PROTECTED;

Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public WebSecurityCustomizer webSecurityCustomizer() {
"/swagger-config/**",
"/webjars/**",
"/swagger/**",
"/favicon.ico"
"/favicon.ico",
"/.well-known/**"
);
};
}
Expand Down

0 comments on commit 0a8dd25

Please sign in to comment.