-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] 솜커톤 모집 API 생성 #73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
639bbe9
fix: 면접 예약 API 면접 일정 조회시 status도 같이 반환
hodoon 0027cfd
Merge branch 'fix/#59-1' into dev
hodoon 2ea02c0
fix: 면접 예약 API 예약자 명단 조회 API 추가
hodoon 7112252
fix: 면접 예약 API 예약되어있는 슬롯은 삭제하지 않는 기능 추가
hodoon 5e118c7
Merge branch 'dev' of https://github.com/DASOM-GitHub/dasom-web-backe…
hodoon 311122c
fix: 면접 예약자 조회 API 면접일, 면접시간, 면접을 예약한 날짜과 시간 추가
hodoon 5ed900c
Merge branch 'dev' of https://github.com/DASOM-GitHub/dasom-web-backe…
hodoon 47e6d4f
Merge branch 'feat/#61-1' into dev
hodoon 0672e0c
Merge branch 'fix/#59-2' into dev
hodoon 47e2cc7
Merge remote-tracking branch 'origin/dev' into dev
hodoon e82390b
feat: 솜커톤 참가자 모집 API 생성
hodoon a37ee6f
feat: 솜커톤 참가자 모집 API 요청 URL에 somkathon 추가
hodoon e217b99
fix: 솜커톤 참가자 모집 API comment 해결
hodoon d66be52
fix: 솜커톤 참가자 모집 API comment 해결
hodoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
...itoty/InterviewReservationRepository.java → ...itory/InterviewReservationRepository.java
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
...w/repositoty/InterviewSlotRepository.java → ...w/repository/InterviewSlotRepository.java
This file contains hidden or 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 hidden or 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
126 changes: 126 additions & 0 deletions
126
src/main/java/dmu/dasom/api/domain/somkathon/controller/SomParticipantController.java
This file contains hidden or 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,126 @@ | ||
| package dmu.dasom.api.domain.somkathon.controller; | ||
|
|
||
| import dmu.dasom.api.domain.somkathon.dto.SomParticipantRequestDto; | ||
| import dmu.dasom.api.domain.somkathon.dto.SomParticipantResponseDto; | ||
| import dmu.dasom.api.domain.somkathon.service.SomParticipantService; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.media.Content; | ||
| import io.swagger.v3.oas.annotations.media.ExampleObject; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.validation.annotation.Validated; | ||
| import org.springframework.web.ErrorResponse; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/somkathon/participants") | ||
| @RequiredArgsConstructor | ||
| @Validated | ||
| public class SomParticipantController { | ||
|
|
||
| private final SomParticipantService somParticipantService; | ||
|
|
||
| /** | ||
| * 참가자 등록 | ||
| */ | ||
| @Operation(summary = "솜커톤 참가자 등록", description = "솜커톤 참가자를 등록합니다.") | ||
| @ApiResponses(value = { | ||
| @ApiResponse(responseCode = "200", description = "참가자 등록 성공"), | ||
| @ApiResponse(responseCode = "400", description = "중복 학번 또는 필수 값 누락", | ||
| content = @Content( | ||
| mediaType = "application/json", | ||
| schema = @Schema(implementation = ErrorResponse.class), | ||
| examples = { | ||
| @ExampleObject( | ||
| name = "중복된 학번", | ||
| value = "{ \"code\": \"C002\", \"message\": \"이미 등록된 학번입니다.\" }" | ||
| ), | ||
| @ExampleObject( | ||
| name = "필수 값 누락", | ||
| value = "{ \"code\": \"C001\", \"message\": \"요청한 값이 올바르지 않습니다.\" }" | ||
| )}))}) | ||
| @PostMapping("/create") | ||
| public ResponseEntity<SomParticipantResponseDto> create(@Valid @RequestBody final SomParticipantRequestDto request) { | ||
| return ResponseEntity.ok(somParticipantService.createParticipant(request)); | ||
| } | ||
|
|
||
| /** | ||
| * 모든 참가자 조회 | ||
| */ | ||
| @Operation(summary = "솜커톤 참가자 목록 조회", description = "모든 솜커톤 참가자를 조회합니다.") | ||
| @ApiResponses(value = { | ||
| @ApiResponse(responseCode = "200", description = "참가자 목록 조회 성공")}) | ||
| @GetMapping | ||
| public ResponseEntity<List<SomParticipantResponseDto>> findAll() { | ||
| return ResponseEntity.ok(somParticipantService.getAllParticipants()); | ||
| } | ||
|
|
||
| /** | ||
| * 특정 참가자 조회 | ||
| */ | ||
| @Operation(summary = "솜커톤 참가자 상세 조회", description = "특정 솜커톤 참가자의 상세 정보를 조회합니다.") | ||
| @ApiResponses(value = { | ||
| @ApiResponse(responseCode = "200", description = "참가자 상세 조회 성공"), | ||
| @ApiResponse(responseCode = "400", description = "존재하지 않는 ID", | ||
| content = @Content( | ||
| mediaType = "application/json", | ||
| schema = @Schema(implementation=ErrorResponse.class), | ||
| examples={ | ||
| @ExampleObject( | ||
| name="존재하지 않는 ID", | ||
| value="{\"code\":\"C004\",\"message\":\"참가자를 찾을 수 없습니다.\"}")}))}) | ||
| @GetMapping("/{id}") | ||
| public ResponseEntity<SomParticipantResponseDto> getById(@PathVariable final Long id) { | ||
| return ResponseEntity.ok(somParticipantService.getParticipant(id)); | ||
| } | ||
|
|
||
| /** | ||
| * 참가자 정보 수정 | ||
| */ | ||
| @Operation(summary = "솜커톤 참가자 정보 수정", description = "특정 솜커톤 참가자의 정보를 수정합니다.") | ||
| @ApiResponses(value = { | ||
| @ApiResponse(responseCode = "200", description = "참가자 정보 수정 성공"), | ||
| @ApiResponse(responseCode = "400", description = "중복 학번 또는 존재하지 않는 ID", | ||
| content = @Content( | ||
| mediaType = "application/json", | ||
| schema=@Schema(implementation=ErrorResponse.class), | ||
| examples={ | ||
| @ExampleObject( | ||
| name="중복된 학번", | ||
| value="{\"code\":\"C002\",\"message\":\"이미 등록된 학번입니다.\"}"), | ||
| @ExampleObject( | ||
| name="존재하지 않는 ID", | ||
| value="{\"code\":\"C004\",\"message\":\"참가자를 찾을 수 없습니다.\"}")}))}) | ||
| @PutMapping("/{id}") | ||
| public ResponseEntity<SomParticipantResponseDto> update(@PathVariable final Long id, | ||
| @Valid @RequestBody final SomParticipantRequestDto request) { | ||
| return ResponseEntity.ok(somParticipantService.updateParticipant(id, request)); | ||
| } | ||
|
|
||
| /** | ||
| * 참가자 삭제 (Delete) | ||
| */ | ||
| @Operation(summary = "솜커톤 참가자 삭제", description = "특정 솜커톤 참가자를 삭제합니다.") | ||
| @ApiResponses(value={ | ||
| @ApiResponse(responseCode="204",description="참가자 삭제 성공"), | ||
| @ApiResponse(responseCode="400",description="존재하지 않는 ID", | ||
| content=@Content( | ||
| mediaType="application/json", | ||
| schema=@Schema(implementation=ErrorResponse.class), | ||
| examples={ | ||
| @ExampleObject( | ||
| name="존재하지 않는 ID", | ||
| value="{\"code\":\"C004\",\"message\":\"참가자를 찾을 수 없습니다.\"}")}))}) | ||
| @DeleteMapping("/{id}") | ||
| public ResponseEntity<Void> delete(@PathVariable final Long id) { | ||
| somParticipantService.deleteParticipant(id); | ||
| return ResponseEntity.noContent().build(); | ||
| } | ||
|
|
||
| } | ||
44 changes: 44 additions & 0 deletions
44
src/main/java/dmu/dasom/api/domain/somkathon/dto/SomParticipantRequestDto.java
This file contains hidden or 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,44 @@ | ||
| package dmu.dasom.api.domain.somkathon.dto; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.Email; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Pattern; | ||
| import jakarta.validation.constraints.Size; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @Schema(description = "솜커톤 참가자 요청 DTO") | ||
| public class SomParticipantRequestDto { | ||
| @NotBlank(message = "참가자 이름은 필수 입력 값입니다.") | ||
| @Size(max = 50, message = "참가자 이름은 최대 50자까지 입력 가능합니다.") | ||
| @Schema(description = "참가자 이름", example = "유승완", required = true) | ||
| private String participantName; // 참가자 이름 | ||
|
|
||
| @NotBlank(message = "학번은 필수 입력 값입니다.") | ||
| @Pattern(regexp = "^[0-9]{8}$", message = "학번은 8자리 숫자여야 합니다.") | ||
| @Schema(description = "학번 (8자리 숫자)", example = "20250001", required = true) | ||
| private String studentId; | ||
|
|
||
| @NotBlank(message = "학과는 필수 입력 값입니다.") | ||
| @Size(max = 100, message = "학과는 최대 100자까지 입력 가능합니다.") | ||
| @Schema(description = "학과", example = "컴퓨터소프트웨어공학과", required = true) | ||
| private String department; // 학과 | ||
|
|
||
| @NotBlank(message = "학년은 필수 입력 값입니다.") | ||
| @Pattern(regexp = "^[1-4]$", message = "학년은 1~4 사이의 숫자여야 합니다.") | ||
| @Schema(description = "학년 (1~4)", example = "3", required = true) | ||
| private String grade; // 학년 | ||
|
|
||
| @NotBlank(message = "연락처는 필수 입력 값입니다.") | ||
| @Pattern(regexp = "^010-[0-9]{4}-[0-9]{4}$", message = "연락처는 '010-XXXX-XXXX' 형식이어야 합니다.") | ||
| @Schema(description = "연락처 (010-XXXX-XXXX 형식)", example = "010-1234-5678", required = true) | ||
| private String contact; // 연락처 | ||
|
|
||
| @NotBlank(message = "이메일은 필수 입력 값입니다.") | ||
| @Email(message = "올바른 이메일 형식이 아닙니다.") | ||
| @Schema(description = "이메일 주소", example = "[email protected]", required = true) | ||
| private String email; // 이메일 | ||
| } |
34 changes: 34 additions & 0 deletions
34
src/main/java/dmu/dasom/api/domain/somkathon/dto/SomParticipantResponseDto.java
This file contains hidden or 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,34 @@ | ||
| package dmu.dasom.api.domain.somkathon.dto; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @Builder | ||
| @Schema(description = "솜커톤 참가자 응답 DTO") | ||
| public class SomParticipantResponseDto { | ||
|
|
||
| @Schema(description = "참가자 ID", example = "1", required = true) | ||
| private Long id; // 참가자 ID | ||
|
|
||
| @Schema(description = "참가자 이름", example = "홍길동", required = true) | ||
| private String participantName; // 참가자 이름 | ||
|
|
||
| @Schema(description = "학번 (8자리 숫자)", example = "20230001", required = true) | ||
| private String studentId; // 학번 | ||
|
|
||
| @Schema(description = "학과", example = "컴퓨터공학과", required = true) | ||
| private String department; // 학과 | ||
|
|
||
| @Schema(description = "학년 (1~4)", example = "3", required = true) | ||
| private String grade; // 학년 | ||
|
|
||
| @Schema(description = "연락처 (010-XXXX-XXXX 형식)", example = "010-1234-5678", required = true) | ||
| private String contact; // 연락처 | ||
|
|
||
| @Schema(description = "이메일 주소", example = "[email protected]", required = true) | ||
| private String email; // 이메일 | ||
| } |
50 changes: 50 additions & 0 deletions
50
src/main/java/dmu/dasom/api/domain/somkathon/entity/SomParticipant.java
This file contains hidden or 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,50 @@ | ||
| package dmu.dasom.api.domain.somkathon.entity; | ||
|
|
||
| import dmu.dasom.api.domain.common.BaseEntity; | ||
| import dmu.dasom.api.domain.somkathon.dto.SomParticipantRequestDto; | ||
| import jakarta.persistence.*; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
|
||
| @AllArgsConstructor | ||
| @Builder | ||
| @Entity | ||
| @EntityListeners(AuditingEntityListener.class) | ||
| @Getter | ||
| @NoArgsConstructor | ||
| public class SomParticipant extends BaseEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(nullable = false) | ||
| private String participantName; // 참가자 이름 | ||
|
|
||
| @Column(nullable = false, unique = true) | ||
| private String studentId; // 학번 | ||
|
|
||
| @Column(nullable = false) | ||
| private String department; // 학과 | ||
|
|
||
| @Column(nullable = false) | ||
| private String grade; // 학년 | ||
|
|
||
| @Column(nullable = false) | ||
| private String contact; // 연락처 | ||
|
|
||
| @Column(nullable = false) | ||
| private String email; // 이메일 | ||
|
|
||
| public void update(SomParticipantRequestDto requestDto) { | ||
| this.participantName = requestDto.getParticipantName(); | ||
| this.studentId = requestDto.getStudentId(); | ||
| this.department = requestDto.getDepartment(); | ||
| this.grade = requestDto.getGrade(); | ||
| this.contact = requestDto.getContact(); | ||
| this.email = requestDto.getEmail(); | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
src/main/java/dmu/dasom/api/domain/somkathon/repository/SomParticipantRepository.java
This file contains hidden or 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,12 @@ | ||
| package dmu.dasom.api.domain.somkathon.repository; | ||
|
|
||
| import dmu.dasom.api.domain.somkathon.entity.SomParticipant; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| @Repository | ||
| public interface SomParticipantRepository extends JpaRepository<SomParticipant, Long> { | ||
| Optional<SomParticipant> findByStudentId(String studentId); // 학번으로 참가자 조회 | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.