From 054fda28fbf309e5c3ed8f7303028e1810c90879 Mon Sep 17 00:00:00 2001 From: si-zero Date: Wed, 27 Aug 2025 14:22:57 +0900 Subject: [PATCH 1/7] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From a02e9bb651a6dc9c5dc4c089c8c48a20767ba9bc Mon Sep 17 00:00:00 2001 From: si-zero Date: Thu, 28 Aug 2025 09:56:29 +0900 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20enum=20=EC=86=8C=EC=86=8D=20?= =?UTF-8?q?=ED=8C=80=20=EC=83=9D=EC=84=B1=20(DASOMBE-21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dasom/api/domain/executive/enums/Team.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/main/java/dmu/dasom/api/domain/executive/enums/Team.java diff --git a/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java b/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java new file mode 100644 index 0000000..fc31807 --- /dev/null +++ b/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java @@ -0,0 +1,16 @@ +package dmu.dasom.api.domain.executive.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum Team { + PRESIDENT("president"), + TECH("tech"), + ACADEMIC("academic"), + MANAGEMENT("management") + ; + + private String name; +} From 9ec4a2689812993d02945f94138c3538d27a37fa Mon Sep 17 00:00:00 2001 From: si-zero Date: Thu, 28 Aug 2025 09:58:21 +0900 Subject: [PATCH 3/7] =?UTF-8?q?refactor:=20=ED=95=84=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD=20(DASOMBE-21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/ExecutiveListResponseDto.java | 13 +++++- .../executive/dto/ExecutiveRequestDto.java | 19 +++++++-- .../executive/dto/ExecutiveResponseDto.java | 13 +++++- .../dto/ExecutiveUpdateRequestDto.java | 14 ++++++- .../executive/entity/ExecutiveEntity.java | 41 +++++++++++++++---- .../service/ExecutiveServiceImpl.java | 2 +- 6 files changed, 82 insertions(+), 20 deletions(-) diff --git a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveListResponseDto.java b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveListResponseDto.java index 7ae845d..c50b4dd 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveListResponseDto.java +++ b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveListResponseDto.java @@ -1,5 +1,6 @@ package dmu.dasom.api.domain.executive.dto; +import dmu.dasom.api.domain.executive.enums.Team; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; @@ -22,7 +23,15 @@ public class ExecutiveListResponseDto { @Schema(description = "임원진 직책", example = "회장") private String position; - @Schema(description = "임원진 깃허브 주소", example = "https://github.com/dasom") - private String githubUrl; + @Schema(description = "수정할 임원진 역할", example = "동아리 운영 총괄", nullable = true) + private String role; + + @Schema(description = "임원진 깃허브 이름", example = "DASOM") + private String github_username; + + @Schema(description = "소속 팀", example = "president, tech, academic, pr, management") + private Team team; + + private Integer sortOrder; } diff --git a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java index 2ba32e8..9fc3751 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java +++ b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java @@ -1,6 +1,7 @@ package dmu.dasom.api.domain.executive.dto; import dmu.dasom.api.domain.executive.entity.ExecutiveEntity; +import dmu.dasom.api.domain.executive.enums.Team; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; @@ -21,17 +22,27 @@ public class ExecutiveRequestDto { @Schema(description = "임원진 이름", example = "김다솜") private String name; - @NotBlank(message = "임원진 역할은 필수 입력 사항입니다.") - @Schema(description = "임원진 역할", example = "회장") + @NotBlank(message = "임원진 직책은 필수 입력 사항입니다.") + @Schema(description = "임원진 직책", example = "회장") private String position; - private String githubUrl; + @NotBlank(message = "임원진 역할은 필수 입력 사항입니다.") + @Schema(description = "임원진 역할", example = "동아리 운영 총괄") + private String role; + + @Schema(description = "임원진 깃허브 이름", example = "DASOM") + private String github_username; + + @Schema(description = "소속 팀", example = "president, tech, academic, pr, management") + private Team team; + + private Integer sortOrder; public ExecutiveEntity toEntity() { return ExecutiveEntity.builder() .name(this.name) .position(this.position) - .githubUrl(this.githubUrl) + .role .build(); } } diff --git a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveResponseDto.java b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveResponseDto.java index a9007ff..0e96fb6 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveResponseDto.java +++ b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveResponseDto.java @@ -1,5 +1,6 @@ package dmu.dasom.api.domain.executive.dto; +import dmu.dasom.api.domain.executive.enums.Team; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; @@ -22,6 +23,14 @@ public class ExecutiveResponseDto { @Schema(description = "임원진 직책", example = "회장") private String position; - @Schema(description = "임원진 깃허브", example = "https://github.com/dasom") - private String githubUrl; + @Schema(description = "수정할 임원진 역할", example = "동아리 운영 총괄") + private String role; + + @Schema(description = "임원진 깃허브 이름", example = "DASOM") + private String github_username; + + @Schema(description = "소속 팀", example = "president, tech, academic, pr, management") + private Team team; + + private Integer sortOrder; } diff --git a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveUpdateRequestDto.java b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveUpdateRequestDto.java index e66f2e9..286dcdb 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveUpdateRequestDto.java +++ b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveUpdateRequestDto.java @@ -1,5 +1,6 @@ package dmu.dasom.api.domain.executive.dto; +import dmu.dasom.api.domain.executive.enums.Team; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; @@ -19,6 +20,15 @@ public class ExecutiveUpdateRequestDto { @Schema(description = "수정할 임원진 직책", example = "회장", nullable = true) private String position; - @Schema(description = "수정할 임원진 깃허브 주소", example = "https://github.com/dasom", nullable = true) - private String githubUrl; + @Schema(description = "수정할 임원진 역할", example = "동아리 운영 총괄", nullable = true) + private String role; + + @Schema(description = "임원진 깃허브 이름", example = "DASOM") + private String github_username; + + @Schema(description = "소속 팀", example = "president, tech, academic, pr, management") + private Team team; + + private Integer sortOrder; + } diff --git a/src/main/java/dmu/dasom/api/domain/executive/entity/ExecutiveEntity.java b/src/main/java/dmu/dasom/api/domain/executive/entity/ExecutiveEntity.java index 849406f..45b1a22 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/entity/ExecutiveEntity.java +++ b/src/main/java/dmu/dasom/api/domain/executive/entity/ExecutiveEntity.java @@ -3,9 +3,12 @@ import dmu.dasom.api.domain.common.BaseEntity; // BaseEntity 상속 받음 import dmu.dasom.api.domain.executive.dto.ExecutiveListResponseDto; import dmu.dasom.api.domain.executive.dto.ExecutiveResponseDto; +import dmu.dasom.api.domain.executive.dto.ExecutiveUpdateRequestDto; +import dmu.dasom.api.domain.executive.enums.Team; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.persistence.*; // JPA 어노테이션 패키지 ( DB 매핑 관련 ) import lombok.*; // 보일러플레이트 코드 자동 생성 라이브러리 +import org.checkerframework.checker.units.qual.C; @Getter @Entity @@ -28,15 +31,31 @@ public class ExecutiveEntity extends BaseEntity { @Column(nullable=false, length = 50) private String position; - // 깃허브 주소 - @Column(nullable=false, length = 255) - private String githubUrl; + // 역할 + @Column(nullable = false, length = 50) + private String role; + + // 깃허브 이름 + @Column(name = "github_username") + private String githubUsername; + + // 소속팀 (president/tech/academic/pr/management) + @Enumerated(EnumType.STRING) + @Column(nullable = false, length = 20) + private Team team; + + @Column(name = "sort_order", nullable = false) + @Builder.Default + private Integer sortOrder = 9999; // 엔티티 업데이트 메소드 - public void update(String name, String position, String githubUrl) { - this.name = name; - this.position = position; - this.githubUrl = githubUrl; + public void update(ExecutiveUpdateRequestDto dto) { + if (dto.getName() != null) this.name = dto.getName(); + if (dto.getPosition() != null) this.position = dto.getPosition(); + if (dto.getRole() != null) this.role = dto.getRole(); + if (dto.getGithub_username() != null) this.githubUsername = dto.getGithub_username(); + if (dto.getTeam() != null) this.team = dto.getTeam(); + if (dto.getSortOrder() != null) this.sortOrder = dto.getSortOrder(); } // 엔티티 -> DTO 변환 책임 @@ -45,7 +64,9 @@ public ExecutiveResponseDto toResponseDto() { .id(this.id) .name(this.name) .position(this.position) - .githubUrl(this.githubUrl) + .role(this.role) + .github_username(this.githubUsername) + .team(this.team) .build(); } @@ -55,7 +76,9 @@ public ExecutiveListResponseDto toListResponseDto() { .id(this.id) .name(this.name) .position(this.position) - .githubUrl(this.githubUrl) + .role(this.role) + .github_username(this.githubUsername) + .team(this.team) .build(); } } diff --git a/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java b/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java index 7d039b9..8e0d4c5 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java +++ b/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java @@ -62,7 +62,7 @@ public ExecutiveResponseDto updateExecutive(Long id, ExecutiveUpdateRequestDto r ExecutiveEntity executive = executiveRepository.findById(id) .orElseThrow(() -> new CustomException(ErrorCode.EXECUTIVE_NOT_FOUND)); - executive.update(requestDto.getName(), requestDto.getPosition(), requestDto.getGithubUrl()); + executive.update(requestDto); return executive.toResponseDto(); } From 174d94e367d3c0dde3f8ea928a389582a549f6fc Mon Sep 17 00:00:00 2001 From: si-zero Date: Thu, 28 Aug 2025 10:04:09 +0900 Subject: [PATCH 4/7] =?UTF-8?q?refactor:=20=ED=95=84=EB=93=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD=20(DASOMBE-21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dasom/api/domain/executive/dto/ExecutiveRequestDto.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java index 9fc3751..8d87f00 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java +++ b/src/main/java/dmu/dasom/api/domain/executive/dto/ExecutiveRequestDto.java @@ -42,7 +42,10 @@ public ExecutiveEntity toEntity() { return ExecutiveEntity.builder() .name(this.name) .position(this.position) - .role + .role(this.role) + .githubUsername(this.github_username) + .team(this.team) + .sortOrder(this.sortOrder) .build(); } } From c402091444c763b2deeabd88800674e0e83a88a4 Mon Sep 17 00:00:00 2001 From: si-zero Date: Thu, 28 Aug 2025 10:04:25 +0900 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=EC=9E=84=EC=9B=90=EC=A7=84=20?= =?UTF-8?q?=EC=A0=84=EC=B2=B4=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC=20=EA=B8=B0=EC=A4=80=20=EC=84=A4=EC=A0=95=20(DASOMBE-?= =?UTF-8?q?21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../executive/service/ExecutiveServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java b/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java index 8e0d4c5..42563d6 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java +++ b/src/main/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceImpl.java @@ -6,6 +6,7 @@ import dmu.dasom.api.domain.executive.entity.ExecutiveEntity; import dmu.dasom.api.domain.executive.repository.ExecutiveRepository; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,11 +32,13 @@ public ExecutiveResponseDto getExecutiveById(Long id) { // 임원진 전체 조회 // 이름, 직책, 깃허브 주소 출력 public List getAllExecutives() { - List executives = executiveRepository.findAll(); + // 전체 조회 시 정렬 + // 기준 sortOrder -> 직책 -> 이름 + Sort sort = Sort.by(Sort.Direction.ASC, "sortOrder") + .and(Sort.by(Sort.Direction.ASC, "position")) + .and(Sort.by(Sort.Direction.DESC, "name")); - List executiveIds = executives.stream() - .map(ExecutiveEntity::getId) - .toList(); + List executives = executiveRepository.findAll(sort); return executives.stream() .map(executiveEntity -> executiveEntity.toListResponseDto()) From b8fd14d06fa56f1016756681031c4880cedff9b9 Mon Sep 17 00:00:00 2001 From: si-zero Date: Thu, 28 Aug 2025 15:49:49 +0900 Subject: [PATCH 6/7] =?UTF-8?q?refactor:=20=EA=B5=AC=EC=A1=B0=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD=20(DASOMBE-?= =?UTF-8?q?21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/ExecutiveServiceTest.java | 42 +++++++++++++++---- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/test/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceTest.java b/src/test/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceTest.java index 4b8a492..93825df 100644 --- a/src/test/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceTest.java +++ b/src/test/java/dmu/dasom/api/domain/executive/service/ExecutiveServiceTest.java @@ -7,6 +7,7 @@ import dmu.dasom.api.domain.executive.dto.ExecutiveResponseDto; import dmu.dasom.api.domain.executive.dto.ExecutiveUpdateRequestDto; import dmu.dasom.api.domain.executive.entity.ExecutiveEntity; +import dmu.dasom.api.domain.executive.enums.Team; import dmu.dasom.api.domain.executive.repository.ExecutiveRepository; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -43,7 +44,9 @@ void getExecutiveById_success() { .id(1L) .name("김다솜") .position("회장") - .githubUrl("https://github.com/dasom") + .role("동아리 운영 총괄") + .githubUsername("DASOM") + .team(Team.PRESIDENT) .build(); when(executiveRepository.findById(id)).thenReturn(Optional.of(entity)); @@ -55,7 +58,9 @@ void getExecutiveById_success() { assertThat(responseDto.getId()).isEqualTo(id); assertThat(responseDto.getName()).isEqualTo("김다솜"); assertThat(responseDto.getPosition()).isEqualTo("회장"); - assertThat(responseDto.getGithubUrl()).isEqualTo("https://github.com/dasom"); + assertThat(responseDto.getRole()).isEqualTo("동아리 운영 총괄"); + assertThat(responseDto.getGithub_username()).isEqualTo("DASOM"); + assertThat(responseDto.getTeam()).isEqualTo(Team.PRESIDENT); // verify ( 호출 검증 ) verify(executiveRepository, times(1)).findById(id); // 메소드를 정확히 한 번만 호출했는지? @@ -83,14 +88,22 @@ void createExecutive_success() { // given Long id = 1L; ExecutiveRequestDto dto = new ExecutiveRequestDto( - id, "김다솜", "회장", "https://github.com/dasom" + id, + "김다솜", + "회장", + "동아리 운영 총괄", + "DASOM", + Team.PRESIDENT, + 1 ); ExecutiveEntity entity = ExecutiveEntity.builder() .id(1L) .name("김다솜") .position("회장") - .githubUrl("https://github.com/dasom") + .role("동아리 운영 총괄") + .githubUsername("DASOM") + .team(Team.PRESIDENT) .build(); when(executiveRepository.save(any(ExecutiveEntity.class))).thenReturn(entity); @@ -119,7 +132,9 @@ void deleteExecutive_success() { .id(1L) .name("김다솜") .position("회장") - .githubUrl("https://github.com/dasom") + .role("동아리 운영 총괄") + .githubUsername("DASOM") + .team(Team.PRESIDENT) .build(); when(executiveRepository.findById(id)).thenReturn(Optional.of(entity)); @@ -158,10 +173,19 @@ void updateExecutive_success() { .id(1L) .name("김다솜") .position("회장") - .githubUrl("https://github.com/dasom") + .role("동아리 운영 총괄") + .githubUsername("DASOM") + .team(Team.PRESIDENT) .build(); - ExecutiveUpdateRequestDto updateEntity = new ExecutiveUpdateRequestDto("김솜다", "부회장", "https://github.com/dasom"); + ExecutiveUpdateRequestDto updateEntity = new ExecutiveUpdateRequestDto( + "김솜다", + "부회장", + "동아리 운영 총괄", + "MOSAD", + Team.ACADEMIC, + 1 + ); when(executiveRepository.findById(id)).thenReturn(Optional.of(entity)); @@ -171,7 +195,9 @@ void updateExecutive_success() { //then assertThat(updateExecutive.getName()).isEqualTo("김솜다"); assertThat(updateExecutive.getPosition()).isEqualTo("부회장"); - assertThat(updateExecutive.getGithubUrl()).isEqualTo("https://github.com/dasom"); + assertThat(updateExecutive.getRole()).isEqualTo("동아리 운영 총괄"); + assertThat(updateExecutive.getGithub_username()).isEqualTo("MOSAD"); + assertThat(updateExecutive.getTeam()).isEqualTo(Team.ACADEMIC); // verify ( 호출 검증 ) verify(executiveRepository, times(1)).findById(id); // 메소드를 정확히 한 번만 호출했는지? From 80007d5c01575a2d3b18121ba3b053e3acaaaea0 Mon Sep 17 00:00:00 2001 From: si-zero Date: Thu, 28 Aug 2025 16:03:19 +0900 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=EC=A7=81=EC=B1=85=20=EB=88=84?= =?UTF-8?q?=EB=9D=BD=EB=90=9C=20=EC=82=AC=ED=95=AD=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?(DASOMBE-21)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/dmu/dasom/api/domain/executive/enums/Team.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java b/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java index fc31807..2921b1f 100644 --- a/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java +++ b/src/main/java/dmu/dasom/api/domain/executive/enums/Team.java @@ -9,7 +9,8 @@ public enum Team { PRESIDENT("president"), TECH("tech"), ACADEMIC("academic"), - MANAGEMENT("management") + MANAGEMENT("management"), + PR("pr") ; private String name;