File tree Expand file tree Collapse file tree 5 files changed +16
-5
lines changed
main/java/dmu/dasom/api/domain/executive
test/java/dmu/dasom/api/domain/executive/service Expand file tree Collapse file tree 5 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 4242# ## dev ###
4343application-dev.yml
4444
45+ # local/dev only
46+ .dev /
47+ docker-compose.yml
48+ init-user.sql
Original file line number Diff line number Diff line change 1515@ Schema (name = "ExecutiveRequestDto" , description = "임원진 요청 DTO" )
1616public class ExecutiveRequestDto {
1717
18- private Long id ;
19-
2018 @ NotBlank (message = "임원진 이름은 필수 입력 사항입니다." )
2119 @ Size (max = 50 , message = "임원진 이름은 최대 50자입니다." )
2220 @ Schema (description = "임원진 이름" , example = "김다솜" )
@@ -45,7 +43,7 @@ public ExecutiveEntity toEntity() {
4543 .role (this .role )
4644 .githubUsername (this .github_username )
4745 .team (this .team )
48- .sortOrder (this . sortOrder )
46+ .sortOrder (sortOrder != null ? sortOrder : 9999 )
4947 .build ();
5048 }
5149}
Original file line number Diff line number Diff line change @@ -58,6 +58,15 @@ public void update(ExecutiveUpdateRequestDto dto) {
5858 if (dto .getSortOrder () != null ) this .sortOrder = dto .getSortOrder ();
5959 }
6060
61+ @ PrePersist
62+ public void prePersist () {
63+ if (sortOrder == null ) sortOrder = 9999 ;
64+ }
65+ @ PreUpdate
66+ public void preUpdate () {
67+ if (sortOrder == null ) sortOrder = 9999 ;
68+ }
69+
6170 // 엔티티 -> DTO 변환 책임
6271 public ExecutiveResponseDto toResponseDto () {
6372 return ExecutiveResponseDto .builder ()
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ public List<ExecutiveListResponseDto> getAllExecutives() {
4747
4848 // 임원진 멤버 생성
4949 public ExecutiveCreationResponseDto createExecutive (ExecutiveRequestDto requestDto ) {
50- return new ExecutiveCreationResponseDto (executiveRepository .save (requestDto .toEntity ()).getId ());
50+ ExecutiveEntity saved = executiveRepository .save (requestDto .toEntity ());
51+ return new ExecutiveCreationResponseDto (saved .getId ());
5152 }
5253
5354 // 임원진 멤버 삭제
Original file line number Diff line number Diff line change @@ -88,7 +88,6 @@ void createExecutive_success() {
8888 // given
8989 Long id = 1L ;
9090 ExecutiveRequestDto dto = new ExecutiveRequestDto (
91- id ,
9291 "김다솜" ,
9392 "회장" ,
9493 "동아리 운영 총괄" ,
You can’t perform that action at this time.
0 commit comments