Skip to content

Commit 643dba3

Browse files
committed
feat: 솜커톤 참가자 Boolean 필드 2개 추가 및 ResponseDto 관련 로직 개선
- SomParticipant : isTransferredInCS(Boolean), isPaid(Boolean) 필드 추가 - SomParticipantRequestDto : isTransferredInCS(Boolean), isPaid(Boolean) 필드 추가 - SomParticipantResponseDto : isTransferredInCS(Boolean), isPaid(Boolean) 필드 추가, Setter 제거 → Builder 기반 불변 객체 - SomParticipantService : createParticipant에서 신규 Boolean 필드 처리 및 toResponseDto 로직 수정
1 parent 4f044a5 commit 643dba3

File tree

4 files changed

+40
-18
lines changed

4 files changed

+40
-18
lines changed

src/main/java/dmu/dasom/api/domain/somkathon/dto/SomParticipantRequestDto.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@ public class SomParticipantRequestDto {
5454
@URL(protocol = "https", message = "포트폴리오 URL이 올바르지 않습니다.")
5555
@Schema(description = "포트폴리오 주소", example = "https://portfolio.com/username", required = true)
5656
private final String portfolioLink; // 포트폴리오 주소
57-
}
57+
58+
@Schema(description = "컴퓨터공학부 내 전과 여부 (true: 컴퓨터공학부 내에서 전과함, false: 다른 학부에서 전과함, null: 전과 안 함)", example = "null")
59+
private final Boolean isTransferredInCS;
60+
61+
@Schema(description = "학생회비 납부 여부 (true: 납부, false: 미납, null: 선택 안 함)", example = "null")
62+
private final Boolean isPaid;
63+
}

src/main/java/dmu/dasom/api/domain/somkathon/dto/SomParticipantResponseDto.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
import io.swagger.v3.oas.annotations.media.Schema;
44
import lombok.Builder;
55
import lombok.Getter;
6-
import lombok.Setter;
76

87
@Getter
9-
@Setter
108
@Builder
119
@Schema(description = "솜커톤 참가자 응답 DTO")
1210
public class SomParticipantResponseDto {
@@ -37,4 +35,10 @@ public class SomParticipantResponseDto {
3735

3836
@Schema(description = "포트폴리오 주소", example = "https://portfolio.com/username", required = true)
3937
private String portfolioLink; // 포트폴리오 주소
38+
39+
@Schema(description = "컴퓨터공학부 내 전과 여부 (true: 컴퓨터공학부 내에서 전과함, false: 다른 학부에서 전과함, null: 전과 안 함)", example = "null")
40+
private Boolean isTransferredInCS; // 컴퓨터공학부 내 전과 여부
41+
42+
@Schema(description = "학생회비 납부 여부 (true: 납부, false: 미납, null: 선택 안 함)", example = "null")
43+
private Boolean isPaid; // 학생회비 납부 여부
4044
}

src/main/java/dmu/dasom/api/domain/somkathon/entity/SomParticipant.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public class SomParticipant extends BaseEntity {
4646
@Column(nullable = false)
4747
private String portfolioLink; // 포트폴리오 링크
4848

49+
@Column
50+
private Boolean isTransferredInCS; // 컴퓨터공학부 내 전과 여부
51+
52+
@Column
53+
private Boolean isPaid; // 학생회비 납부 여부
54+
4955
public void update(SomParticipantRequestDto requestDto) {
5056
this.participantName = requestDto.getParticipantName();
5157
this.studentId = requestDto.getStudentId();
@@ -55,22 +61,26 @@ public void update(SomParticipantRequestDto requestDto) {
5561
this.email = requestDto.getEmail();
5662
this.githubLink = requestDto.getGithubLink();
5763
this.portfolioLink = requestDto.getPortfolioLink();
64+
this.isTransferredInCS = requestDto.getIsTransferredInCS();
65+
this.isPaid = requestDto.getIsPaid();
5866
}
5967

6068
/**
6169
* Entity → Response DTO 변환 메서드
6270
*/
63-
public SomParticipantResponseDto toResponseDto(SomParticipant participant) {
71+
public SomParticipantResponseDto toResponseDto() {
6472
return SomParticipantResponseDto.builder()
65-
.id(participant.getId())
66-
.participantName(participant.getParticipantName())
67-
.studentId(participant.getStudentId())
68-
.department(participant.getDepartment())
69-
.grade(participant.getGrade())
70-
.contact(participant.getContact())
71-
.email(participant.getEmail())
72-
.githubLink(participant.getGithubLink())
73-
.portfolioLink(participant.getPortfolioLink())
73+
.id(this.getId())
74+
.participantName(this.getParticipantName())
75+
.studentId(this.getStudentId())
76+
.department(this.getDepartment())
77+
.grade(this.getGrade())
78+
.contact(this.getContact())
79+
.email(this.getEmail())
80+
.githubLink(this.getGithubLink())
81+
.portfolioLink(this.getPortfolioLink())
82+
.isTransferredInCS(this.getIsTransferredInCS())
83+
.isPaid(this.getIsPaid())
7484
.build();
7585
}
76-
}
86+
}

src/main/java/dmu/dasom/api/domain/somkathon/service/SomParticipantService.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,21 @@ public SomParticipantResponseDto createParticipant(SomParticipantRequestDto requ
3131
.email(requestDto.getEmail())
3232
.githubLink(requestDto.getGithubLink())
3333
.portfolioLink(requestDto.getPortfolioLink())
34+
.isTransferredInCS(requestDto.getIsTransferredInCS())
35+
.isPaid(requestDto.getIsPaid())
3436
.build();
3537

3638
SomParticipant saved = somParticipantRepository.save(participant);
3739

38-
return saved.toResponseDto(saved);
40+
return saved.toResponseDto();
3941
}
4042

4143
/**
4244
* 모든 참가자 조회 (Read)
4345
*/
4446
public List<SomParticipantResponseDto> getAllParticipants() {
4547
return somParticipantRepository.findAll().stream()
46-
.map(p -> p.toResponseDto(p))
48+
.map(SomParticipant::toResponseDto)
4749
.collect(Collectors.toList());
4850
}
4951

@@ -53,7 +55,7 @@ public List<SomParticipantResponseDto> getAllParticipants() {
5355
public SomParticipantResponseDto getParticipant(Long id){
5456
SomParticipant participant = findParticipantById(id);
5557

56-
return participant.toResponseDto(participant);
58+
return participant.toResponseDto();
5759
}
5860

5961
/**
@@ -64,7 +66,7 @@ public SomParticipantResponseDto updateParticipant(Long id, SomParticipantReques
6466

6567
participant.update(requestDto);
6668

67-
return participant.toResponseDto(participant);
69+
return participant.toResponseDto();
6870
}
6971

7072
/**

0 commit comments

Comments
 (0)