-
Notifications
You must be signed in to change notification settings - Fork 3
[feature] 활성화된 동아리 지원서만 보여준다 #769
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
5 commits
Select commit
Hold shift + click to select a range
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
104 changes: 104 additions & 0 deletions
104
backend/src/main/java/moadong/club/controller/ClubApplyControllerV1.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,104 @@ | ||
| package moadong.club.controller; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.security.SecurityRequirement; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import jakarta.validation.Valid; | ||
| import jakarta.validation.constraints.NotEmpty; | ||
| import lombok.AllArgsConstructor; | ||
| import moadong.club.entity.ClubApplicationForm; | ||
| import moadong.club.enums.ApplicationFormStatus; | ||
| import moadong.club.payload.request.ClubApplicantDeleteRequest; | ||
| import moadong.club.payload.request.ClubApplicantEditRequest; | ||
| import moadong.club.payload.request.ClubApplyRequest; | ||
| import moadong.club.repository.ClubApplicationFormsRepository; | ||
| import moadong.club.service.ClubApplyService; | ||
| import moadong.global.exception.ErrorCode; | ||
| import moadong.global.exception.RestApiException; | ||
| import moadong.global.payload.Response; | ||
| import moadong.user.annotation.CurrentUser; | ||
| import moadong.user.payload.CustomUserDetails; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.security.access.prepost.PreAuthorize; | ||
| import org.springframework.validation.annotation.Validated; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/club/{clubId}") | ||
| @AllArgsConstructor | ||
| @Tag(name = "Club_Apply_V1", | ||
| description = "클럽 지원서 수정 전 API <br>" | ||
| + "구버전 호환을 위한 임시 API입니다. <br>" | ||
| + "프론트에서 formId 기반 신규 규격으로 전환하기 전까지 clubId 기반 요청을 한시적으로 지원합니다. <br>" | ||
| + "(clubId로 활성화된 최신 지원서 양식의 formId를 가져옴)") | ||
|
Comment on lines
+28
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 구버전 지원좋습니다 |
||
| public class ClubApplyControllerV1 { | ||
|
|
||
| private final ClubApplyService clubApplyService; | ||
| private final ClubApplicationFormsRepository clubApplicationFormsRepository; | ||
|
|
||
| @GetMapping("/apply") // | ||
| @Operation(summary = "클럽 지원서 양식 불러오기", | ||
| description = "clubId를 기반으로 활성화된 최신 지원서를 반환합니다. <br>" | ||
| + "<br>v2 api : /api/club/{clubId}/apply/{applicationFormId}") | ||
| public ResponseEntity<?> getClubApplication(@PathVariable String clubId) { | ||
|
|
||
| return clubApplyService.getClubApplicationForm(clubId, convertClubIdToFormId(clubId)); | ||
| } | ||
|
|
||
| @PostMapping("/apply") | ||
| @Operation(summary = "클럽 지원", description = "clubId를 기반으로 활성화된 최신 지원서에 지원합니다. <br>" | ||
| + "<br>v2 api : /api/club/{clubId}/apply/{applicationFormId}") | ||
| public ResponseEntity<?> applyToClub(@PathVariable String clubId, | ||
| @RequestBody @Validated ClubApplyRequest request) { | ||
| clubApplyService.applyToClub(clubId, convertClubIdToFormId(clubId), request); | ||
| return Response.ok("success apply"); | ||
| } | ||
|
|
||
| @GetMapping("/apply/info") | ||
| @Operation(summary = "클럽 지원자 현황", description = "clubId를 기반으로 활성화된 최신 지원서의 지원자 현황을 불러옵니다 <br>" | ||
| + "<br>v2 api : /api/club/{clubId}/apply/info/{applicationFormId}") | ||
lepitaaar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @PreAuthorize("isAuthenticated()") | ||
| @SecurityRequirement(name = "BearerAuth") | ||
| public ResponseEntity<?> getApplyInfo(@PathVariable String clubId, | ||
| @CurrentUser CustomUserDetails user) { | ||
| return Response.ok(clubApplyService.getClubApplyInfo(clubId, convertClubIdToFormId(clubId), user)); | ||
| } | ||
|
|
||
| @PutMapping("/applicant") | ||
| @Operation(summary = "지원자의 지원서 정보 변경", | ||
| description = "여러 지원자의 지원서 정보를 일괄 수정합니다.<br>" | ||
| + "요청 본문은 ClubApplicantEditRequest 객체의 배열이며, 각 원소는 applicantId, memo, status를 포함합니다." | ||
| + "<br><br>v2 api : /api/club/{clubId}/applicant/{applicationFormId}" | ||
| ) | ||
| @PreAuthorize("isAuthenticated()") | ||
| @SecurityRequirement(name = "BearerAuth") | ||
| public ResponseEntity<?> editApplicantDetail(@PathVariable String clubId, | ||
| @RequestBody @Valid @NotEmpty List<ClubApplicantEditRequest> request, | ||
| @CurrentUser CustomUserDetails user) { | ||
| clubApplyService.editApplicantDetail(clubId, convertClubIdToFormId(clubId), request, user); | ||
| return Response.ok("success edit applicant"); | ||
| } | ||
|
|
||
| @DeleteMapping("/applicant") | ||
| @Operation(summary = "지원자 삭제", | ||
| description = "clubId를 기반으로 활성화된 최신 지원서의 지원자의 지원서를 삭제합니다. <br>" | ||
| + "<br>v2 api : /api/club/{clubId}/applicant/{applicationFormId}" | ||
| ) | ||
| @PreAuthorize("isAuthenticated()") | ||
| @SecurityRequirement(name = "BearerAuth") | ||
| public ResponseEntity<?> removeApplicant(@PathVariable String clubId, | ||
| @RequestBody @Validated ClubApplicantDeleteRequest request, | ||
| @CurrentUser CustomUserDetails user) { | ||
| clubApplyService.deleteApplicant(clubId,convertClubIdToFormId(clubId), request, user); | ||
| return Response.ok("success delete applicant"); | ||
| } | ||
|
|
||
|
|
||
| private String convertClubIdToFormId(String clubId) { | ||
| return clubApplicationFormsRepository.findTopByClubIdAndStatusOrderByEditedAtDesc(clubId, ApplicationFormStatus.ACTIVE) | ||
| .map(ClubApplicationForm::getId) | ||
| .orElseThrow(() -> new RestApiException(ErrorCode.APPLICATION_NOT_FOUND)); | ||
| } | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 구버전 남긴 건 정말 좋은 거 같아요! |
||
11 changes: 11 additions & 0 deletions
11
backend/src/main/java/moadong/club/payload/dto/ClubActiveFormResult.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,11 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record ClubActiveFormResult( | ||
| String id, | ||
| String title, | ||
| String description | ||
| ) { | ||
| } |
7 changes: 7 additions & 0 deletions
7
backend/src/main/java/moadong/club/payload/dto/ClubActiveFormSlim.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,7 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| public interface ClubActiveFormSlim { | ||
| String getId(); | ||
| String getTitle(); | ||
| String getDescription(); | ||
| } |
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
5 changes: 4 additions & 1 deletion
5
backend/src/main/java/moadong/club/payload/dto/ClubApplicationFormsResultItem.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 |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| package moadong.club.payload.dto; | ||
|
|
||
| import moadong.club.enums.ApplicationFormStatus; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| public record ClubApplicationFormsResultItem( | ||
| String id, | ||
| String title, | ||
| LocalDateTime editedAt | ||
| LocalDateTime editedAt, | ||
| ApplicationFormStatus status | ||
| ) { } |
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
12 changes: 12 additions & 0 deletions
12
backend/src/main/java/moadong/club/payload/response/ClubActiveFormsResponse.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 moadong.club.payload.response; | ||
|
|
||
| import lombok.Builder; | ||
| import moadong.club.payload.dto.ClubActiveFormResult; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Builder | ||
| public record ClubActiveFormsResponse ( | ||
| List<ClubActiveFormResult> forms | ||
| ){ | ||
| } |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
성능 테스트를 위해 모드를 넣은 건가요?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 개발서버랑 메인서버에서 성능테스트가 필요할 거 같습니다