-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: 응답 DTO Record 타입으로 변경 (#159)
* refactor: 응답 DTO 반환 클래스 Record로 변경 - 불변 클래스 record를 사용 * refactor: 응답 DTO 및 Generation Entity 필드를 래퍼클래스로 통일 * refactor: 정적 팩토리 메서드 네이밍 패턴에 따른 메서드 이름 변경 - 변수가 여러개 -> of - 변수가 1개라면 -> from * style: 코드 공백 조정
- Loading branch information
Showing
26 changed files
with
98 additions
and
128 deletions.
There are no files selected for viewing
31 changes: 14 additions & 17 deletions
31
src/main/java/cotato/csquiz/controller/dto/AllEducationResponse.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,23 +1,20 @@ | ||
package cotato.csquiz.controller.dto; | ||
|
||
import cotato.csquiz.domain.entity.Education; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class AllEducationResponse { | ||
private Long educationId; | ||
private String subject; | ||
private int educationNumber; | ||
private int sessionNumber; | ||
public record AllEducationResponse( | ||
Long educationId, | ||
String subject, | ||
Integer educationNumber, | ||
Integer sessionNumber | ||
) { | ||
|
||
public static AllEducationResponse convertFromEducation(Education education) { | ||
return AllEducationResponse.builder() | ||
.educationId(education.getId()) | ||
.subject(education.getSubject()) | ||
.educationNumber(education.getNumber()) | ||
.sessionNumber(education.getSession().getNumber()) | ||
.build(); | ||
public static AllEducationResponse from(Education education) { | ||
return new AllEducationResponse( | ||
education.getId(), | ||
education.getSubject(), | ||
education.getNumber(), | ||
education.getSession().getNumber() | ||
); | ||
} | ||
} | ||
} |
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
16 changes: 7 additions & 9 deletions
16
src/main/java/cotato/csquiz/controller/dto/auth/FindPasswordResponse.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,11 +1,9 @@ | ||
package cotato.csquiz.controller.dto.auth; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class FindPasswordResponse { | ||
|
||
private String accessToken; | ||
} | ||
public record FindPasswordResponse( | ||
String accessToken | ||
) { | ||
public static FindPasswordResponse from(String accessToken) { | ||
return new FindPasswordResponse(accessToken); | ||
} | ||
} |
14 changes: 7 additions & 7 deletions
14
src/main/java/cotato/csquiz/controller/dto/education/CreateEducationResponse.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,11 +1,11 @@ | ||
package cotato.csquiz.controller.dto.education; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import cotato.csquiz.domain.entity.Education; | ||
|
||
@Data | ||
@Builder | ||
public class CreateEducationResponse { | ||
|
||
private Long educationId; | ||
public record CreateEducationResponse( | ||
Long educationId | ||
) { | ||
public static CreateEducationResponse from(Education education) { | ||
return new CreateEducationResponse(education.getId()); | ||
} | ||
} |
14 changes: 7 additions & 7 deletions
14
src/main/java/cotato/csquiz/controller/dto/education/FindEducationStatusResponse.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,12 +1,12 @@ | ||
package cotato.csquiz.controller.dto.education; | ||
|
||
import cotato.csquiz.domain.entity.Education; | ||
import cotato.csquiz.domain.enums.EducationStatus; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
public class FindEducationStatusResponse { | ||
|
||
private EducationStatus status; | ||
public record FindEducationStatusResponse( | ||
EducationStatus status | ||
) { | ||
public static FindEducationStatusResponse from(Education education) { | ||
return new FindEducationStatusResponse(education.getStatus()); | ||
} | ||
} |
14 changes: 7 additions & 7 deletions
14
src/main/java/cotato/csquiz/controller/dto/generation/AddGenerationResponse.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,11 +1,11 @@ | ||
package cotato.csquiz.controller.dto.generation; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import cotato.csquiz.domain.entity.Generation; | ||
|
||
@Data | ||
@Builder | ||
public class AddGenerationResponse { | ||
|
||
private Long generationId; | ||
public record AddGenerationResponse( | ||
Long generationId | ||
) { | ||
public static AddGenerationResponse from(Generation generation) { | ||
return new AddGenerationResponse(generation.getId()); | ||
} | ||
} |
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
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
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
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
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
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
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
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
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
18 changes: 11 additions & 7 deletions
18
src/main/java/cotato/csquiz/controller/dto/session/AddSessionResponse.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,11 +1,15 @@ | ||
package cotato.csquiz.controller.dto.session; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import cotato.csquiz.domain.entity.Session; | ||
|
||
@Data | ||
@Builder | ||
public class AddSessionResponse { | ||
private Long sessionId; | ||
private int sessionNumber; | ||
public record AddSessionResponse( | ||
Long sessionId, | ||
Integer sessionNumber | ||
) { | ||
public static AddSessionResponse from(Session session) { | ||
return new AddSessionResponse( | ||
session.getId(), | ||
session.getNumber() | ||
); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.