-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…부-사항-수정 Refactor : 반환 데이터 변경 및 세부 사항 수정
- Loading branch information
Showing
11 changed files
with
242 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 21 additions & 23 deletions
44
src/main/java/land/leets/Carrot/domain/user/dto/request/CeoSignupRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
package land.leets.Carrot.domain.user.dto.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class CeoSignupRequest { | ||
@NotNull | ||
private String email; | ||
@NotNull | ||
private String password; | ||
@NotNull | ||
private String ceoName; | ||
@NotNull | ||
private String ceoPhoneNumber; | ||
@NotNull | ||
private String ceoNumber; | ||
@NotNull | ||
private String storeName; | ||
@NotNull | ||
private String openDate; | ||
@NotNull | ||
private String ceoAddress; | ||
public record CeoSignupRequest( | ||
String email, | ||
String password, | ||
String ceoName, | ||
String ceoPhoneNumber, | ||
String ceoNumber, | ||
String storeName, | ||
String openDate, | ||
String ceoAddress | ||
) { | ||
public static CeoSignupRequest of(String email, | ||
String password, | ||
String ceoName, | ||
String ceoPhoneNumber, | ||
String ceoNumber, | ||
String storeName, | ||
String openDate, | ||
String ceoAddress) { | ||
return new CeoSignupRequest(email, password, ceoName, ceoPhoneNumber, ceoNumber, storeName, openDate, | ||
ceoAddress); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/land/leets/Carrot/domain/user/dto/response/CeoBasicInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package land.leets.Carrot.domain.user.dto.response; | ||
|
||
import land.leets.Carrot.domain.user.entity.Ceo; | ||
import land.leets.Carrot.domain.user.entity.Gender; | ||
|
||
public record CeoBasicInfoResponse( | ||
String ceoName, | ||
String ceoPhoneNumber, | ||
String ceoAddress, | ||
Gender gender, | ||
Integer birthYear | ||
) implements UserBasicInfoResponse { | ||
public static CeoBasicInfoResponse from(Ceo ceo) { | ||
return new CeoBasicInfoResponse( | ||
ceo.getCeoName(), | ||
ceo.getCeoPhoneNumber(), | ||
ceo.getCeoAddress(), | ||
ceo.getGender(), | ||
ceo.getBirthYear() | ||
); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
src/main/java/land/leets/Carrot/domain/user/dto/response/CeoProfileResponse.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/main/java/land/leets/Carrot/domain/user/dto/response/EmployeeBasicInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package land.leets.Carrot.domain.user.dto.response; | ||
|
||
import land.leets.Carrot.domain.user.entity.Employee; | ||
import land.leets.Carrot.domain.user.entity.Gender; | ||
|
||
public record EmployeeBasicInfoResponse( | ||
String employeeName, | ||
String employeeAddress, | ||
String phoneNumber, | ||
Gender gender, | ||
Integer birthYear | ||
) implements UserBasicInfoResponse { | ||
public static EmployeeBasicInfoResponse from(Employee employee) { | ||
return new EmployeeBasicInfoResponse( | ||
employee.getEmployeeName(), | ||
employee.getEmployeeAddress(), | ||
employee.getPhoneNumber(), | ||
employee.getGender(), | ||
employee.getBirthYear() | ||
); | ||
} | ||
} |
62 changes: 50 additions & 12 deletions
62
src/main/java/land/leets/Carrot/domain/user/dto/response/EmployeeProfileResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,56 @@ | ||
package land.leets.Carrot.domain.user.dto.response; | ||
|
||
import land.leets.Carrot.domain.user.entity.Employee; | ||
import lombok.Getter; | ||
import land.leets.Carrot.domain.user.entity.Gender; | ||
|
||
@Getter | ||
public class EmployeeProfileResponse extends ProfileResponse { | ||
private final String employeeName; | ||
private final String employeeAddress; | ||
private final String phoneNumber; | ||
|
||
public EmployeeProfileResponse(Employee employee) { | ||
super(employee.getGender(), employee.getBirthYear()); | ||
this.employeeName = employee.getEmployeeName(); | ||
this.employeeAddress = employee.getEmployeeAddress(); | ||
this.phoneNumber = employee.getPhoneNumber(); | ||
public record EmployeeProfileResponse( | ||
String phoneNumber, | ||
String employeeName, | ||
String employeeAddress, | ||
String workplace, | ||
String workType, | ||
String workYear, | ||
String workPeriod, | ||
String selfIntro, | ||
boolean isSmoke, | ||
boolean isLongWork, | ||
boolean isCarLicense, | ||
boolean isEnglish, | ||
boolean isMilitary, | ||
boolean isCookLicense, | ||
boolean isDiligent, | ||
boolean isOnTime, | ||
boolean isClean, | ||
boolean isNearHome, | ||
boolean isSleepless, | ||
Gender gender, | ||
Integer birthYear, | ||
String profileImageUrl | ||
) { | ||
public static EmployeeProfileResponse from(Employee employee) { | ||
return new EmployeeProfileResponse( | ||
employee.getPhoneNumber(), | ||
employee.getEmployeeName(), | ||
employee.getEmployeeAddress(), | ||
employee.getWorkplace(), | ||
employee.getWorkType(), | ||
employee.getWorkYear(), | ||
employee.getWorkPeriod(), | ||
employee.getSelfIntro(), | ||
employee.isSmoke(), | ||
employee.isLongWork(), | ||
employee.isCarLicense(), | ||
employee.isEnglish(), | ||
employee.isMilitary(), | ||
employee.isCookLicense(), | ||
employee.isDiligent(), | ||
employee.isOnTime(), | ||
employee.isClean(), | ||
employee.isNearHome(), | ||
employee.isSleepless(), | ||
employee.getGender(), | ||
employee.getBirthYear(), | ||
employee.getProfileImageUrl() | ||
); | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
src/main/java/land/leets/Carrot/domain/user/dto/response/ProfileResponse.java
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/main/java/land/leets/Carrot/domain/user/dto/response/UserBasicInfoResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package land.leets.Carrot.domain.user.dto.response; | ||
|
||
import land.leets.Carrot.domain.user.entity.Ceo; | ||
import land.leets.Carrot.domain.user.entity.Employee; | ||
import land.leets.Carrot.domain.user.entity.Gender; | ||
import land.leets.Carrot.domain.user.entity.User; | ||
import land.leets.Carrot.domain.user.exception.UnknownUserTypeException; | ||
|
||
public sealed interface UserBasicInfoResponse permits CeoBasicInfoResponse, EmployeeBasicInfoResponse { | ||
Gender gender(); | ||
|
||
Integer birthYear(); | ||
|
||
static UserBasicInfoResponse from(User user) { | ||
if (user instanceof Employee employee) { | ||
return EmployeeBasicInfoResponse.from(employee); | ||
} else if (user instanceof Ceo ceo) { | ||
return CeoBasicInfoResponse.from(ceo); | ||
} else { | ||
throw new UnknownUserTypeException(); | ||
} | ||
} | ||
} |
Oops, something went wrong.