-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor/KD-53 로그인 응답 필드 추가 및 논문,자격증 조회 API 추가,ScheduleQueryService 전체 조회시 일정 타입순서로 출력하도록 변경 #300
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
10 commits
Select commit
Hold shift + click to select a range
376d973
refactore/KD-53 : 일정 조회 서비스 로직 수정
dkdltm221 ebc6f5a
Merge remote-tracking branch 'origin/develop' into refactor/KD-53
dkdltm221 6c927c4
refactore/KD-53 : 일정 조회 서비스 로직 순서 조정
dkdltm221 74a5ae1
refactore/KD-53 : 로그인 토큰값에 role,graduationType추가
dkdltm221 6601202
refactore/KD-53 : 로그인 토큰값 추가에따른 test코드 변경
dkdltm221 fa97121
refactore/KD-53 : 졸업,논문 개별 조회 API 구현
dkdltm221 7c9a860
refactore/KD-53 : 오타 수정
dkdltm221 a1fbfc0
refactore/KD-53 : 카테고리에 졸업 값 추가
dkdltm221 7cc453f
refactore/KD-53 : 기존 aics-api -> aics-admin으로 파일 이동시켰습니다.
dkdltm221 fc05df4
refactore/KD-53 : 논문,자격증 admin test코드 작성
dkdltm221 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
25 changes: 25 additions & 0 deletions
25
...in/src/main/java/kgu/developers/admin/certificate/application/CertificateAdminFacade.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,25 @@ | ||
| package kgu.developers.admin.certificate.application; | ||
|
|
||
| import kgu.developers.admin.certificate.presentation.response.CertificateDetailResponse; | ||
| import kgu.developers.domain.certificate.application.query.CertificateQueryService; | ||
| import kgu.developers.domain.certificate.domain.Certificate; | ||
| import kgu.developers.domain.file.application.query.FileQueryService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| @Component | ||
| @Transactional | ||
| @RequiredArgsConstructor | ||
| public class CertificateAdminFacade { | ||
| private final CertificateQueryService certificateQueryService; | ||
| private final FileQueryService fileQueryService; | ||
|
|
||
| public CertificateDetailResponse getById(Long id){ | ||
| Certificate certificate = certificateQueryService.getById(id); | ||
| String physicalPath = certificate.getCertificateFileId() != null | ||
| ? fileQueryService.getFilePhysicalPath(certificate.getCertificateFileId()) | ||
| : null; | ||
| return CertificateDetailResponse.from(certificate, physicalPath); | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
...c/main/java/kgu/developers/admin/certificate/presentation/CertificateAdminController.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,25 @@ | ||
| package kgu.developers.admin.certificate.presentation; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import io.swagger.v3.oas.annotations.media.Content; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import kgu.developers.admin.certificate.presentation.response.CertificateDetailResponse; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
|
|
||
| @Tag(name = "Certificate", description = "자격증 관련 API") | ||
| public interface CertificateAdminController { | ||
| @Operation(summary = "자격증 개별 조회 API", description = """ | ||
| - Description : 자격증 id로 조회합니다. | ||
| - Assignee : 주윤빈 | ||
| """) | ||
| @ApiResponse( | ||
| responseCode = "200", | ||
| content = @Content(schema = @Schema(implementation = CertificateDetailResponse.class))) | ||
| ResponseEntity<CertificateDetailResponse> getCertificate( | ||
| @Parameter(description = "자격증 id",required = true) @PathVariable Long id | ||
| ); | ||
| } |
25 changes: 25 additions & 0 deletions
25
...in/java/kgu/developers/admin/certificate/presentation/CertificateAdminControllerImpl.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,25 @@ | ||
| package kgu.developers.admin.certificate.presentation; | ||
|
|
||
| import kgu.developers.admin.certificate.application.CertificateAdminFacade; | ||
| import kgu.developers.admin.certificate.presentation.response.CertificateDetailResponse; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.security.access.prepost.PreAuthorize; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/v1/admin/certificate") | ||
| @RequiredArgsConstructor | ||
| @PreAuthorize("hasRole('ROLE_ADMIN')") | ||
| public class CertificateAdminControllerImpl implements CertificateAdminController { | ||
| private final CertificateAdminFacade certificateAdminFacade; | ||
|
|
||
| @Override | ||
| @GetMapping("/{id}") | ||
| public ResponseEntity<CertificateDetailResponse> getCertificate(@PathVariable Long id) { | ||
| return ResponseEntity.ok(certificateAdminFacade.getById(id)); | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
...ava/kgu/developers/admin/certificate/presentation/response/CertificateDetailResponse.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,39 @@ | ||
| package kgu.developers.admin.certificate.presentation.response; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import kgu.developers.domain.certificate.domain.Certificate; | ||
| import kgu.developers.domain.file.application.response.FilePathResponse; | ||
| import lombok.Builder; | ||
|
|
||
| import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; | ||
| import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | ||
|
|
||
| @Builder | ||
| public record CertificateDetailResponse( | ||
| @Schema(description = "자격증 객체 id", example = "1", requiredMode = REQUIRED) | ||
| Long id, | ||
|
|
||
| @Schema(description = "자격증 관련 일정 ID", example = "4", requiredMode = REQUIRED) | ||
| Long scheduleId, | ||
|
|
||
| @Schema(description = "승인 여부", example = "false",requiredMode = REQUIRED) | ||
| boolean approval, | ||
|
|
||
| @Schema(description = "첨부 파일 정보", | ||
| example = "{\"id\": 1, " | ||
| + "\"physicalPath\": \"/files/2025-certificate\"}", | ||
| requiredMode = NOT_REQUIRED) | ||
| FilePathResponse certificateFile | ||
| ) { | ||
| public static CertificateDetailResponse from(Certificate certificate,String physicalPath) { | ||
| return CertificateDetailResponse.builder() | ||
| .id(certificate.getId()) | ||
| .scheduleId(certificate.getScheduleId()) | ||
| .approval(certificate.isApproved()) | ||
| .certificateFile(certificate.getCertificateFileId() != null | ||
| ? FilePathResponse.of(certificate.getCertificateFileId(),physicalPath) | ||
| : null | ||
| ) | ||
| .build(); | ||
| } | ||
| } | ||
26 changes: 26 additions & 0 deletions
26
aics-admin/src/main/java/kgu/developers/admin/thesis/application/ThesisAdminFacade.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,26 @@ | ||
| package kgu.developers.admin.thesis.application; | ||
|
|
||
| import kgu.developers.admin.thesis.presentation.response.ThesisDetailResponse; | ||
| import kgu.developers.domain.file.application.query.FileQueryService; | ||
| import kgu.developers.domain.thesis.application.query.ThesisQueryService; | ||
| import kgu.developers.domain.thesis.domain.Thesis; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| @Component | ||
| @Transactional | ||
| @RequiredArgsConstructor | ||
| public class ThesisAdminFacade { | ||
|
|
||
| private final ThesisQueryService thesisQueryService; | ||
| private final FileQueryService fileQueryService; | ||
|
|
||
| public ThesisDetailResponse getById(Long id){ | ||
| Thesis thesis = thesisQueryService.getById(id); | ||
| String physicalPath = thesis.getThesisFileId() != null | ||
| ? fileQueryService.getFilePhysicalPath(thesis.getThesisFileId()) | ||
| : null; | ||
| return ThesisDetailResponse.from(thesis, physicalPath); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
aics-admin/src/main/java/kgu/developers/admin/thesis/presentation/ThesisAdminController.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,26 @@ | ||
| package kgu.developers.admin.thesis.presentation; | ||
|
|
||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.Parameter; | ||
| import io.swagger.v3.oas.annotations.media.Content; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import kgu.developers.admin.thesis.presentation.response.ThesisDetailResponse; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
|
|
||
| @Tag(name = "Thesis", description = "졸업 논문 API") | ||
| public interface ThesisAdminController { | ||
|
|
||
| @Operation(summary = "졸업 논문 개별 조회 API", description = """ | ||
| - Description :논문 id로 조회합니다. | ||
| - Assignee : 주윤빈 | ||
| """) | ||
| @ApiResponse( | ||
| responseCode = "200", | ||
| content = @Content(schema = @Schema(implementation = ThesisDetailResponse.class))) | ||
| ResponseEntity<ThesisDetailResponse> getThesis( | ||
| @Parameter(description = "논문 id",required = true) @PathVariable Long id | ||
| ); | ||
| } |
25 changes: 25 additions & 0 deletions
25
...min/src/main/java/kgu/developers/admin/thesis/presentation/ThesisAdminControllerImpl.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,25 @@ | ||
| package kgu.developers.admin.thesis.presentation; | ||
|
|
||
| import kgu.developers.admin.thesis.application.ThesisAdminFacade; | ||
| import kgu.developers.admin.thesis.presentation.response.ThesisDetailResponse; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.security.access.prepost.PreAuthorize; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/v1/admin/thesis") | ||
| @RequiredArgsConstructor | ||
| @PreAuthorize("hasRole('ROLE_ADMIN')") | ||
| public class ThesisAdminControllerImpl implements ThesisAdminController { | ||
| private final ThesisAdminFacade thesisAdminFacade; | ||
|
|
||
| @Override | ||
| @GetMapping("/{id}") | ||
| public ResponseEntity<ThesisDetailResponse> getThesis(@PathVariable Long id) { | ||
| return ResponseEntity.ok(thesisAdminFacade.getById(id)); | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
...src/main/java/kgu/developers/admin/thesis/presentation/response/ThesisDetailResponse.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,36 @@ | ||
| package kgu.developers.admin.thesis.presentation.response; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import kgu.developers.domain.file.application.response.FilePathResponse; | ||
| import kgu.developers.domain.thesis.domain.Thesis; | ||
| import lombok.Builder; | ||
|
|
||
| import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; | ||
| import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | ||
|
|
||
| @Builder | ||
| public record ThesisDetailResponse( | ||
| @Schema(description = "졸업 논문 객체 id", example = "1", requiredMode = REQUIRED) | ||
| Long id, | ||
| @Schema(description = "졸업 논문 관련 일정 ID",example = "2",requiredMode = REQUIRED) | ||
| Long scheduleId, | ||
| @Schema(description = "승인 여부", example = "false",requiredMode = REQUIRED) | ||
| boolean approval, | ||
|
|
||
| @Schema(description = "첨부 파일 정보", | ||
| example = "{\"id\": 1, " | ||
| + "\"physicalPath\": \"/files/2025-thesis\"}", | ||
| requiredMode = NOT_REQUIRED) | ||
| FilePathResponse thesisFile | ||
|
|
||
| ) { | ||
| public static ThesisDetailResponse from(Thesis thesis,String physicalPath) { | ||
| return ThesisDetailResponse.builder() | ||
| .id(thesis.getId()) | ||
| .scheduleId(thesis.getScheduleId()) | ||
| .approval(thesis.isApproved()) | ||
| .thesisFile(thesis.getThesisFileId() != null | ||
| ? FilePathResponse.of(thesis.getThesisFileId(),physicalPath): null) | ||
| .build(); | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
aics-admin/src/testFixtures/java/certificate/application/CertificateAdminFacadeTest.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 certificate.application; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
|
||
| import kgu.developers.admin.certificate.application.CertificateAdminFacade; | ||
| import kgu.developers.admin.certificate.presentation.response.CertificateDetailResponse; | ||
| import kgu.developers.domain.certificate.application.query.CertificateQueryService; | ||
| import kgu.developers.domain.certificate.domain.Certificate; | ||
| import kgu.developers.domain.certificate.exception.CertificateNotFoundException; | ||
| import kgu.developers.domain.file.application.query.FileQueryService; | ||
| import mock.repository.FakeCertificateRepository; | ||
| import mock.repository.FakeFileRepository; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class CertificateAdminFacadeTest { | ||
|
|
||
| private CertificateAdminFacade certificateAdminFacade; | ||
| private FakeCertificateRepository fakeCertificateRepository; | ||
|
|
||
| @BeforeEach | ||
| void init(){ | ||
| fakeCertificateRepository = new FakeCertificateRepository(); | ||
| certificateAdminFacade= new CertificateAdminFacade( | ||
| new CertificateQueryService(fakeCertificateRepository), | ||
| new FileQueryService(new FakeFileRepository())); | ||
| fakeCertificateRepository.save(Certificate.of(1L,3L,null,true,null,null,null)); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("getById는 자격증 정보를 반환한다.") | ||
| void getById_success(){ | ||
| CertificateDetailResponse response = certificateAdminFacade.getById(1L); | ||
|
|
||
| assertEquals(1L,response.id()); | ||
| assertEquals(3L,response.scheduleId()); | ||
| assertEquals(true,response.approval()); | ||
| assertEquals(null,response.certificateFile()); | ||
| } | ||
| @Test | ||
| @DisplayName("없는 id 조회 시 CertificateNotFoundException") | ||
| void getById_notFound() { | ||
| assertThatThrownBy(() -> certificateAdminFacade.getById(999L)) | ||
| .isInstanceOf(CertificateNotFoundException.class); | ||
| } | ||
|
|
||
|
|
||
| } |
49 changes: 49 additions & 0 deletions
49
aics-admin/src/testFixtures/java/thesis/ThesisAdminFacadeTest.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,49 @@ | ||
| package thesis; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
|
||
| import kgu.developers.admin.thesis.application.ThesisAdminFacade; | ||
| import kgu.developers.admin.thesis.presentation.response.ThesisDetailResponse; | ||
| import kgu.developers.domain.file.application.query.FileQueryService; | ||
| import kgu.developers.domain.thesis.application.query.ThesisQueryService; | ||
| import kgu.developers.domain.thesis.domain.Thesis; | ||
| import kgu.developers.domain.thesis.exception.ThesisNotFoundException; | ||
| import mock.repository.FakeFileRepository; | ||
| import mock.repository.FakeThesisRepository; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class ThesisAdminFacadeTest { | ||
| private ThesisAdminFacade thesisAdminFacade; | ||
| private FakeThesisRepository fakeThesisRepository; | ||
|
|
||
| @BeforeEach | ||
| void init(){ | ||
| fakeThesisRepository = new FakeThesisRepository(); | ||
| thesisAdminFacade = new ThesisAdminFacade( | ||
| new ThesisQueryService(fakeThesisRepository), | ||
| new FileQueryService(new FakeFileRepository()) | ||
| ); | ||
| fakeThesisRepository.save(Thesis.of(1L,3L,null,false,null,null,null)); | ||
| } | ||
|
|
||
| @Test | ||
| @DisplayName("getById는 논문 정보를 반환한다") | ||
| void getById(){ | ||
| ThesisDetailResponse response = thesisAdminFacade.getById(1L); | ||
|
|
||
| assertEquals(1L,response.id()); | ||
| assertEquals(3L, response.scheduleId()); | ||
| assertEquals(false, response.approval()); | ||
| assertEquals(null, response.thesisFile()); | ||
| } | ||
| @Test | ||
| @DisplayName("없는 id 조회 시 ThesisNotFoundException") | ||
| void getById_notFound() { | ||
| assertThatThrownBy(() -> thesisAdminFacade.getById(999L)) | ||
| .isInstanceOf(ThesisNotFoundException.class); | ||
| } | ||
|
|
||
| } |
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
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.
메서드 시그니처의 포맷을 수정해주세요.
파라미터 사이에 공백이 누락되었습니다.
certificate,String을certificate, String으로 수정해주세요.🔎 포맷 수정 제안
📝 Committable suggestion
🤖 Prompt for AI Agents