Skip to content

Commit

Permalink
feat: University 정보를 nullable하게 변경한다.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarltj committed Jul 29, 2024
1 parent 1017a6b commit 258d3f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
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
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
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;
@Column
private Integer grade;

public void update(String universityName, int grade) {
Assert.hasText(universityName, "대학 이름은 필수 입력값입니다.");

this.universityName = universityName;
this.grade = grade;
}

public static UserUniversity of(Long userId, String universityName, int grade) {
Assert.hasText(universityName, "대학 이름은 필수 입력값입니다.");

return UserUniversity.builder()
.userId(userId)
.universityName(universityName)
Expand Down

0 comments on commit 258d3f7

Please sign in to comment.