From 57096f991afa0d3981ed2fd4a688f8ae01e8c332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Fri, 30 Aug 2024 20:48:24 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[feat][#98]=20schedule=20=EC=A4=91=EB=B3=B5?= =?UTF-8?q?=20=EC=A0=80=EC=9E=A5=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/bbo_gak/domain/recruit/service/RecruitService.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java b/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java index b1ad00a..9323118 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java @@ -1,7 +1,6 @@ package com.server.bbo_gak.domain.recruit.service; import com.server.bbo_gak.domain.recruit.dao.RecruitRepository; -import com.server.bbo_gak.domain.recruit.dao.RecruitScheduleRepository; import com.server.bbo_gak.domain.recruit.dto.request.RecruitCreateRequest; import com.server.bbo_gak.domain.recruit.dto.request.RecruitScheduleCreateRequest; import com.server.bbo_gak.domain.recruit.dto.response.RecruitGetInnerResponse; @@ -30,7 +29,6 @@ public class RecruitService { private final RecruitRepository recruitRepository; private final SeasonService seasonService; private final RecruitScheduleService recruitScheduleService; - private final RecruitScheduleRepository recruitScheduleRepository; public List getTotalRecruitList(User user) { List recruits = recruitRepository.findAllByUserId(user.getId()); @@ -121,7 +119,6 @@ private void addRecruitScheduleIfRequired(RecruitCreateRequest request, Recruit RecruitScheduleCreateRequest.of( request.recruitScheduleStage(), request.deadLine()) ); - recruitScheduleRepository.save(recruitSchedule); recruit.addSchedule(recruitSchedule); } } From a408dc43df9f2e4071d282727e74e1c8172ddbdc Mon Sep 17 00:00:00 2001 From: Byuk_mm Date: Fri, 30 Aug 2024 21:48:17 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[feat][#95]=20=EC=B9=B4=EB=93=9C=20?= =?UTF-8?q?=EB=8B=A8=EA=B1=B4=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=EA=B0=84=20=ED=8F=AC=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbo_gak/domain/card/dto/response/CardGetResponse.java | 2 ++ .../bbo_gak/domain/card/controller/CardControllerTest.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java b/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java index bb108d6..b8fffc1 100644 --- a/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java +++ b/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java @@ -12,6 +12,7 @@ public record CardGetResponse( String title, String content, + String createdDate, String updatedDate, String cardTypeValueGroup, List cardTypeValueList, @@ -33,6 +34,7 @@ public static CardGetResponse of(Card card, List cardTagList) { .content(card.getContent()) .cardTypeValueGroup( CardTypeValueGroup.findByCardTypeValue(card.getCardTypeList().getFirst().getCardTypeValue()).getValue()) + .createdDate(card.getCreatedDate().format(BaseDateTimeFormatter.getLocalDateTimeFormatter())) .updatedDate(card.getUpdatedDate().format(BaseDateTimeFormatter.getLocalDateTimeFormatter())) .cardTypeValueList(cardTypeValueList) .tagList(tagGetResponseList) diff --git a/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java b/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java index 185d78c..32f5cdc 100644 --- a/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java +++ b/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java @@ -97,6 +97,7 @@ class 카드_단건_조회 { .responseFields(fieldWithPath("title").type(JsonFieldType.STRING).description("Card 제목"), fieldWithPath("content").type(JsonFieldType.STRING).description("Card 내용"), fieldWithPath("cardTypeValueList").type(JsonFieldType.ARRAY).description("Card 타입값 리스트"), + fieldWithPath("createdDate").type(JsonFieldType.STRING).description("Card 생성일시"), fieldWithPath("updatedDate").type(JsonFieldType.STRING).description("Card 수정일시"), fieldWithPath("cardTypeValueGroup").type(JsonFieldType.STRING).description("Card 그룹 이름"), fieldWithPath("tagList.[].id").type(JsonFieldType.NUMBER).description("태그 ID"), From f2e0589f017ae316032d933c6f1fde525ba344a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:00:22 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[fix][#98]=20=EC=A7=84=ED=96=89=20=EC=A4=91?= =?UTF-8?q?=20=EA=B3=B5=EA=B3=A0=20=ED=95=84=ED=84=B0=EB=A7=81=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../server/bbo_gak/domain/recruit/entity/RecruitStatus.java | 2 +- .../bbo_gak/domain/recruit/entity/RecruitStatusCategory.java | 4 ++-- .../server/bbo_gak/domain/recruit/service/RecruitService.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatus.java b/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatus.java index a4fa5e3..6546f1a 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatus.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatus.java @@ -15,7 +15,7 @@ public enum RecruitStatus { DOCUMENT_PASSED("서류 통과"), DOCUMENT_REJECTION("서류 탈락"), INTERVIEW_PASSED("면접 통과"), - INTERVIEW_REJECTION("서류 탈락"), + INTERVIEW_REJECTION("면접 탈락"), FINAL_ACCEPTANCE("최종 합격"), FINAL_REJECTED("최종 탈락"); diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatusCategory.java b/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatusCategory.java index 3e5447f..6bc3588 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatusCategory.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/entity/RecruitStatusCategory.java @@ -25,7 +25,7 @@ public enum RecruitStatusCategory { private final List statuses; - public static boolean isRejectionStatus(RecruitStatus status) { - return REJECTION_STATUS.getStatuses().contains(status); + public static boolean isRejectionStatusOrFinalAcceptance(RecruitStatus status) { + return REJECTION_STATUS.getStatuses().contains(status) || RecruitStatus.FINAL_ACCEPTANCE.equals(status); } } diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java b/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java index 9323118..5b9877d 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/service/RecruitService.java @@ -80,7 +80,7 @@ private LocalDate getNearestUpcomingDate(Recruit recruit) { private Map> partitionRecruits(List recruits) { return recruits.stream() - .filter(recruit -> !RecruitStatusCategory.isRejectionStatus( + .filter(recruit -> !RecruitStatusCategory.isRejectionStatusOrFinalAcceptance( recruit.getRecruitStatus())) // 불합격 상태 필터링 .collect(Collectors.partitioningBy(this::isNeedsScheduleUpdate)); } From 680204769c5c76b12179f989dd3373bb8d2e01ce Mon Sep 17 00:00:00 2001 From: Byuk_mm Date: Fri, 30 Aug 2024 22:03:42 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[feat][#95]=20=EC=9D=B8=EC=84=B1=20?= =?UTF-8?q?=ED=83=9C=EA=B7=B8=20=EC=A1=B0=ED=9A=8C=20=EC=A1=B0=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/server/bbo_gak/domain/card/dao/TagRepository.java | 2 +- .../com/server/bbo_gak/domain/card/service/TagService.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/server/bbo_gak/domain/card/dao/TagRepository.java b/src/main/java/com/server/bbo_gak/domain/card/dao/TagRepository.java index 223bf3e..a7a8794 100644 --- a/src/main/java/com/server/bbo_gak/domain/card/dao/TagRepository.java +++ b/src/main/java/com/server/bbo_gak/domain/card/dao/TagRepository.java @@ -7,7 +7,7 @@ public interface TagRepository extends JpaRepository { - List findAllByJob(Job job); + List findAllByJobIsIn(List jobList); List findAllByIdIsNotIn(List idList); diff --git a/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java b/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java index a21c4bc..501411a 100644 --- a/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java +++ b/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java @@ -7,6 +7,7 @@ import com.server.bbo_gak.domain.card.entity.Card; import com.server.bbo_gak.domain.card.entity.CardTag; import com.server.bbo_gak.domain.card.entity.Tag; +import com.server.bbo_gak.domain.user.entity.Job; import com.server.bbo_gak.domain.user.entity.User; import com.server.bbo_gak.global.error.exception.BusinessException; import com.server.bbo_gak.global.error.exception.ErrorCode; @@ -27,7 +28,7 @@ public class TagService { @Transactional(readOnly = true) public List getAllTagList(User user) { - return tagRepository.findAllByJob(user.getJob()).stream() + return tagRepository.findAllByJobIsIn(List.of(user.getJob(), Job.ALL)).stream() .map(TagGetResponse::from) .toList(); } From 0d5a8e46d566f85ebf7e262ed8a15a57d851d744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=84=B8=EC=A4=80?= <74056843+sejoon00@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:05:19 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[fix][#98]=20=EC=A7=84=ED=96=89=20=EC=A4=91?= =?UTF-8?q?=20=EA=B3=B5=EA=B3=A0=20=EC=A7=80=EC=9B=90=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=20=EA=B8=B0=EB=B3=B8=EA=B0=92=20=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/recruit/dto/request/RecruitCreateRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/server/bbo_gak/domain/recruit/dto/request/RecruitCreateRequest.java b/src/main/java/com/server/bbo_gak/domain/recruit/dto/request/RecruitCreateRequest.java index a07f655..e24a4f1 100644 --- a/src/main/java/com/server/bbo_gak/domain/recruit/dto/request/RecruitCreateRequest.java +++ b/src/main/java/com/server/bbo_gak/domain/recruit/dto/request/RecruitCreateRequest.java @@ -18,7 +18,7 @@ public Recruit toEntity(User user, Season season) { .season(season) .title(title) .siteUrl(siteUrl) - .recruitStatus(RecruitStatus.APPLICATION_COMPLETED) + .recruitStatus(RecruitStatus.PREPARATION_IN_PROGRESS) .user(user) .build(); } From f674ae0820e9d8d09a3ae84848286eb1d6f342d7 Mon Sep 17 00:00:00 2001 From: Byuk_mm Date: Sat, 31 Aug 2024 00:18:54 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[feat][#95]=20=EA=B3=B5=EA=B3=A0=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=83=9C=EA=B7=B8=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=EB=90=9C=20=ED=83=9C=EA=B7=B8=EB=A7=8C=20?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EA=B2=8C=EB=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/card/controller/TagController.java | 8 +++++ .../card/dto/response/CardGetResponse.java | 8 +++++ .../domain/card/service/TagService.java | 16 +++++++++ .../card/controller/CardControllerTest.java | 1 + .../card/controller/TagControllerTest.java | 36 +++++++++++++++++++ 5 files changed, 69 insertions(+) diff --git a/src/main/java/com/server/bbo_gak/domain/card/controller/TagController.java b/src/main/java/com/server/bbo_gak/domain/card/controller/TagController.java index b6a3b32..15cd345 100644 --- a/src/main/java/com/server/bbo_gak/domain/card/controller/TagController.java +++ b/src/main/java/com/server/bbo_gak/domain/card/controller/TagController.java @@ -28,6 +28,14 @@ public ResponseEntity> getAllTagList( return ResponseEntity.ok(tagService.getAllTagList(user)); } + @GetMapping("/recruits/{recruit-id}/tags") + public ResponseEntity> getAllRecruitsTagList( + @AuthUser User user, + @PathVariable("recruit-id") Long recruitId + ) { + return ResponseEntity.ok(tagService.getAllRecruitsTagList(user, recruitId)); + } + @GetMapping("/cards/{card-id}/tags") public ResponseEntity> getcCardTagList( @AuthUser User user, diff --git a/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java b/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java index b8fffc1..96248d7 100644 --- a/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java +++ b/src/main/java/com/server/bbo_gak/domain/card/dto/response/CardGetResponse.java @@ -3,8 +3,10 @@ import com.server.bbo_gak.domain.card.entity.Card; import com.server.bbo_gak.domain.card.entity.CardTag; import com.server.bbo_gak.domain.card.entity.CardTypeValueGroup; +import com.server.bbo_gak.domain.recruit.entity.Recruit; import com.server.bbo_gak.global.utils.BaseDateTimeFormatter; import java.util.List; +import java.util.Optional; import lombok.AccessLevel; import lombok.Builder; @@ -14,6 +16,7 @@ public record CardGetResponse( String content, String createdDate, String updatedDate, + String recruitTitle, String cardTypeValueGroup, List cardTypeValueList, List tagList @@ -29,9 +32,14 @@ public static CardGetResponse of(Card card, List cardTagList) { .map(cardType -> cardType.getCardTypeValue().getValue()) .toList(); + String recruitTitle = Optional.ofNullable(card.getRecruit()) + .map(Recruit::getTitle) + .orElse(null); + return CardGetResponse.builder() .title(card.getTitle()) .content(card.getContent()) + .recruitTitle(recruitTitle) .cardTypeValueGroup( CardTypeValueGroup.findByCardTypeValue(card.getCardTypeList().getFirst().getCardTypeValue()).getValue()) .createdDate(card.getCreatedDate().format(BaseDateTimeFormatter.getLocalDateTimeFormatter())) diff --git a/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java b/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java index 501411a..b334095 100644 --- a/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java +++ b/src/main/java/com/server/bbo_gak/domain/card/service/TagService.java @@ -7,6 +7,8 @@ import com.server.bbo_gak.domain.card.entity.Card; import com.server.bbo_gak.domain.card.entity.CardTag; import com.server.bbo_gak.domain.card.entity.Tag; +import com.server.bbo_gak.domain.recruit.dao.RecruitRepository; +import com.server.bbo_gak.domain.recruit.entity.Recruit; import com.server.bbo_gak.domain.user.entity.Job; import com.server.bbo_gak.domain.user.entity.User; import com.server.bbo_gak.global.error.exception.BusinessException; @@ -24,6 +26,7 @@ public class TagService { private final CardRepository cardRepository; private final TagRepository tagRepository; private final CardTagRepository cardTagRepository; + private final RecruitRepository recruitRepository; @Transactional(readOnly = true) public List getAllTagList(User user) { @@ -33,6 +36,19 @@ public List getAllTagList(User user) { .toList(); } + @Transactional(readOnly = true) + public List getAllRecruitsTagList(User user, Long recruitId) { + + Recruit recruit = recruitRepository.findByUserIdAndId(user.getId(), recruitId) + .orElseThrow(() -> new NotFoundException(ErrorCode.RECRUIT_NOT_FOUND)); + + return recruit.getCardList().stream() + .flatMap(card -> card.getCardTagList().stream().map(CardTag::getTag)) + .distinct() + .map(TagGetResponse::from) + .toList(); + } + @Transactional(readOnly = true) public List getTagListInCard(User user, Long cardId) { diff --git a/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java b/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java index 32f5cdc..1c21fab 100644 --- a/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java +++ b/src/test/java/com/server/bbo_gak/domain/card/controller/CardControllerTest.java @@ -96,6 +96,7 @@ class 카드_단건_조회 { .responseSchema(Schema.schema("CardGetResponse")) .responseFields(fieldWithPath("title").type(JsonFieldType.STRING).description("Card 제목"), fieldWithPath("content").type(JsonFieldType.STRING).description("Card 내용"), + fieldWithPath("recruitTitle").type(JsonFieldType.STRING).optional().description("공고 제목"), fieldWithPath("cardTypeValueList").type(JsonFieldType.ARRAY).description("Card 타입값 리스트"), fieldWithPath("createdDate").type(JsonFieldType.STRING).description("Card 생성일시"), fieldWithPath("updatedDate").type(JsonFieldType.STRING).description("Card 수정일시"), diff --git a/src/test/java/com/server/bbo_gak/domain/card/controller/TagControllerTest.java b/src/test/java/com/server/bbo_gak/domain/card/controller/TagControllerTest.java index d592955..de00445 100644 --- a/src/test/java/com/server/bbo_gak/domain/card/controller/TagControllerTest.java +++ b/src/test/java/com/server/bbo_gak/domain/card/controller/TagControllerTest.java @@ -75,6 +75,42 @@ private ResourceSnippetParameters getSuccessResponseResource() { } } + @Nested + class 전체_태그_목록_조회_공고에서 { + + @Test + @Transactional + public void 성공() throws Exception { + + // TEST + ResultActions resultActions = mockMvc.perform(getRequest()) + .andExpect(status().isOk()); + + // DOCS + resultActions.andDo(document("[전체_태그_목록_조회_공고에서] 성공", resource(getSuccessResponseResource()))); + } + + private MockHttpServletRequestBuilder getRequest() { + return get(DEFAULT_URL + "/recruits/{recruit-id}/tags", 1L) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON); + } + + private ResourceSnippetParameters getSuccessResponseResource() { + return ResourceSnippetParameters.builder() + .description("전체 카드 태그 목록").tags("Tag") + .pathParameters( + parameterWithName("recruit-id").description("recruit-id") + ) + .responseSchema(Schema.schema("TagGetResponse")) + .responseFields( + fieldWithPath("[].id").type(JsonFieldType.NUMBER).description("태그 ID"), + fieldWithPath("[].name").type(JsonFieldType.STRING).description("태그 이름"), + fieldWithPath("[].type").type(JsonFieldType.STRING).description("태그 타입")) + .build(); + } + } + @Nested class 카드_태그_목록_조회 {