Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/kkijuk/backend into feat…
Browse files Browse the repository at this point in the history
…ure/introduce
  • Loading branch information
Suhun0331 committed Nov 19, 2024
2 parents 7d2850f + 42e5a18 commit d6fa096
Show file tree
Hide file tree
Showing 44 changed files with 726 additions and 45 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/CICD_DEVELOP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,26 @@ jobs:
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
content: |
Server successfully updated to Commit[${{ steps.slug.outputs.sha7 }}] on branch ${{ github.ref_name }}
Commit message: ${{ github.event.head_commit.message }}
:o: Server successfully updated!
Commit: [${{ github.sha }}]
Branch: ${{ github.ref_name }}
Commit Link: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
GitHub Action Link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
GitHub Action Link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
failure_notification:
name: Failure Notification
runs-on: ubuntu-latest
if: failure()

steps:
- name: Discord Webhook Action on Failure
uses: tsickert/[email protected]
with:
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
content: |
:x: A job failed in the CI/CD pipeline!
Commit: [${{ github.sha }}]
Branch: ${{ github.ref_name }}
Commit Link: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
GitHub Action Link: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Please check the logs for more details.
21 changes: 3 additions & 18 deletions .github/workflows/CI_MVP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,9 @@ name: CI FOR MVP

on:
push:
branches:
- mvp/apply
- mvp/member
- mvp/career
- mvp/portfolio
- feature/record
- feature/home
- feature/recruit-tag
- feature/login
- feature/login-memberTest
- refactor/career
- feature/login-recruit
- fix/record
- feature/errorFix
- fix/credential
- feature/dashboard
- feature/career-refactor
- feature/introduce
branches-ignore:
- main
- develop

jobs:
CI:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,5 +305,35 @@ public CareerResponse<List<FindDetailResponse>> findTagAndDetail(
baseCareerService.findAllDetailByTag(requestMember, tagId, sort)
);
}
@GetMapping("/find")
@Operation(
summary = "활동 검색 - 활동",
description = "활동을 주어진 조건에 맞추어 조회합니다. query 값으로 검색어(keyword)와 정렬 기준(new,old)을 주세요. " )
public CareerResponse<List<FindCareerResponse>> findCareerWithKeyword(
@Login LoginInfo loginInfo,
@RequestParam(name = "keyword") String keyword,
@RequestParam(name = "sort") String sort
){
Member requestMember = memberService.getById(loginInfo.getMemberId());
return CareerResponse.success(
CareerResponseMessage.CAREER_FINDALL_SUCCESS,
baseCareerService.findCareerWithKeyword(requestMember, keyword, sort)
);

}
@GetMapping("/timeline")
@Operation(
summary = "활동 타임라인",
description = "타임라인에 필요한 활동 정보들을 조회합니다.")
public CareerResponse<List<TimelineResponse>> findCareerForTimeline(
@Login LoginInfo loginInfo
){
Member requestMember = memberService.getById(loginInfo.getMemberId());
return CareerResponse.success(
CareerResponseMessage.CAREER_FINDALL_SUCCESS,
baseCareerService.findCareerForTimeline(requestMember)
);

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package umc.kkijuk.server.career.controller.response;

import lombok.*;
import umc.kkijuk.server.career.domain.BaseCareer;

import java.time.LocalDate;

@Data
@Getter
@Setter
@Builder
@AllArgsConstructor
public class FindCareerResponse {
private Long careerId;
private String careerType;
private String careerTitle;
private String careerAlias;
private LocalDate startdate;
private LocalDate enddate;

public FindCareerResponse(BaseCareer career, String careerType){
this.careerId = career.getId();
this.careerType = careerType;
this.careerTitle = career.getName();
this.careerAlias = career.getAlias();
this.startdate = career.getStartdate();
this.enddate = career.getEnddate();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package umc.kkijuk.server.career.controller.response;

import lombok.*;
import umc.kkijuk.server.career.domain.BaseCareer;

import java.time.LocalDate;

@Data
@Getter
@Setter
@Builder
@AllArgsConstructor
public class TimelineResponse {
private Long careerId;
private String category;
private String title;
private LocalDate startdate;
private LocalDate enddate;
public TimelineResponse(BaseCareer career, String type){
this.careerId = career.getId();
this.title = career.getName();
this.startdate = career.getStartdate();
this.enddate = career.getEnddate();
this.category = type;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.time.LocalDateTime;



@Getter
@MappedSuperclass
@NoArgsConstructor(access = AccessLevel.PROTECTED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface ActivityRepository extends JpaRepository<Activity, Long> {
List<Activity> findByMemberId(Long memberId);
List<Activity> findByMemberIdAndNameContaining(Long memberId, String keyword);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface CircleRepository extends JpaRepository<Circle, Long> {
List<Circle> findByMemberId(Long memberId);
List<Circle> findByMemberIdAndNameContaining(Long memberId, String keyword);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface CompetitionRepository extends JpaRepository<Competition, Long> {
List<Competition> findByMemberId(Long memberId);
List<Competition> findByMemberIdAndNameContaining(Long memberId, String keyword);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface EduCareerRepository extends JpaRepository<EduCareer,Long> {
List<EduCareer> findByMemberId(Long memberId);
List<EduCareer> findByMemberIdAndNameContaining(Long memberId, String keyword);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface EmploymentRepository extends JpaRepository<Employment,Long> {
List<Employment> findByMemberId(Long memberId);
List<Employment> findByMemberIdAndNameContaining(Long memberId, String keyword);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

public interface ProjectRepository extends JpaRepository<Project, Long> {
List<Project> findByMemberId(Long memberId);
List<Project> findByMemberIdAndNameContaining(Long memberId, String keyword);
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ public interface BaseCareerService {
List<FindTagResponse> findAllTag(Member requestMember, String keyword);

List<FindDetailResponse> findAllDetailByTag(Member requestMember, Long tagId, String sort);

List<FindCareerResponse> findCareerWithKeyword(Member requestMember, String keyword, String sort);

List<TimelineResponse> findCareerForTimeline(Member requestMember);
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.time.LocalDate;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;

@Service
Expand Down Expand Up @@ -505,10 +504,49 @@ public List<FindDetailResponse> findAllDetailByTag(Member requestMember, Long ta
return buildDetailResponse(detailList, sort);
}

@Override
public List<FindCareerResponse> findCareerWithKeyword(Member requestMember, String keyword, String sort) {
List<BaseCareer> careers = new ArrayList<>();
careers.addAll(activityRepository.findByMemberIdAndNameContaining(requestMember.getId(),keyword));
careers.addAll(eduCareerRepository.findByMemberIdAndNameContaining(requestMember.getId(),keyword));
careers.addAll(employmentRepository.findByMemberIdAndNameContaining(requestMember.getId(),keyword));
careers.addAll(circleRepository.findByMemberIdAndNameContaining(requestMember.getId(),keyword));
careers.addAll(projectRepository.findByMemberIdAndNameContaining(requestMember.getId(),keyword));
careers.addAll(competitionRepository.findByMemberIdAndNameContaining(requestMember.getId(),keyword));

if ("new".equalsIgnoreCase(sort)) {
careers.sort(Comparator.comparing(BaseCareer::getEnddate).reversed());
} else {
careers.sort(Comparator.comparing(BaseCareer::getEnddate));
}

return careers.stream().limit(2)
.map(career -> new FindCareerResponse(career, career.getClass().getSimpleName()))
.collect(Collectors.toList());

}

@Override
public List<TimelineResponse> findCareerForTimeline(Member requestMember) {
Long memberId = requestMember.getId();
List<BaseCareer> careers = new ArrayList<>();


careers.addAll(activityRepository.findByMemberId(memberId));
careers.addAll(eduCareerRepository.findByMemberId(memberId));
careers.addAll(employmentRepository.findByMemberId(memberId));
careers.addAll(circleRepository.findByMemberId(memberId));
careers.addAll(projectRepository.findByMemberId(memberId));
careers.addAll(competitionRepository.findByMemberId(memberId));


careers.sort(Comparator.comparing(BaseCareer::getEnddate).reversed());

return careers.stream()
.map(career -> new TimelineResponse(career, career.getClass().getSimpleName()))
.collect(Collectors.toList());
}


private List<FindDetailResponse> buildDetailResponse(List<BaseCareerDetail> detailList, String sort) {
Map<String, Map<Long, List<BaseCareerDetail>>> groupedDetails = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.persistence.AttributeConverter;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.List;

@Component
public class StringListToStringConverter implements AttributeConverter<List<String>, String> {
private static final ObjectMapper mapper = new ObjectMapper()
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ public class RecruitController {
private final ReviewService reviewService;
private final MemberService memberService;

// private final Member requestMember = Member.builder()
// .id(LoginUser.get().getId())
// .build();

@Operation(
summary = "지원 공고 생성",
description = "주어진 정보를 바탕으로 지원 공고 데이터를 생성합니다.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package umc.kkijuk.server.recruit.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import umc.kkijuk.server.login.argumentresolver.Login;
import umc.kkijuk.server.login.controller.dto.LoginInfo;
import umc.kkijuk.server.member.domain.Member;
import umc.kkijuk.server.member.service.MemberService;
import umc.kkijuk.server.recruit.controller.port.RecruitSearchService;
import umc.kkijuk.server.recruit.controller.response.RecruitReviewListByKeywordResponse;

@Tag(name = "Search Recruit", description = "공고 검색 API")
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/recruit")
public class RecruitSearchController {

private final RecruitSearchService recruitSearchService;
private final MemberService memberService;

@Operation(
summary = "공고 이름 & 태그 / 공고 후기 기준으로 검색",
description = "입력받은 텍스트에 대하여, 공고 제목, 공고 태그, 혹은 공고 후기에 포함하는 모든 공고를 검색합니다. 정렬기준은 최신순입니다.")
@GetMapping
public ResponseEntity<RecruitReviewListByKeywordResponse> findRecruitsByKeyword(
@Login LoginInfo loginInfo,
@RequestParam String keyword) {

Member requestMember = memberService.getById(loginInfo.getMemberId());
RecruitReviewListByKeywordResponse result = recruitSearchService.findRecruitByKeyword(requestMember, keyword);

return ResponseEntity
.ok()
.body(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import umc.kkijuk.server.common.LoginUser;
import umc.kkijuk.server.login.argumentresolver.Login;
import umc.kkijuk.server.login.controller.dto.LoginInfo;
import umc.kkijuk.server.member.domain.Member;
import umc.kkijuk.server.member.service.MemberService;
import umc.kkijuk.server.recruit.controller.response.RecruitTagResponse;

import java.util.ArrayList;
import java.util.List;

@Tag(name = "recruitTag", description = "모집 공고 태그 API")
Expand All @@ -22,11 +20,6 @@
public class RecruitTagController {
private final MemberService memberService;

// private final Member requestMember = Member.builder()
// .id(LoginUser.get().getId())
// .recruitTags(new ArrayList<>(List.of("인턴", "정규직", "대외활동", "동아리")))
// .build();

@Operation(
summary = "지원 공고 태그",
description = "사용자의 지원 공고 태그 정보들을 요청합니다")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package umc.kkijuk.server.recruit.controller.port;

import umc.kkijuk.server.member.domain.Member;
import umc.kkijuk.server.recruit.controller.response.RecruitReviewListByKeywordResponse;

public interface RecruitSearchService {

public RecruitReviewListByKeywordResponse findRecruitByKeyword(Member requestMember, String keyword);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package umc.kkijuk.server.recruit.controller.port;

import org.springframework.transaction.annotation.Transactional;
import umc.kkijuk.server.member.domain.Member;
import umc.kkijuk.server.recruit.domain.*;

Expand All @@ -9,7 +8,6 @@
import java.util.List;

public interface RecruitService {
@Transactional
Recruit create(Member member, RecruitCreate recruitCreate);

Recruit update(Member member, Long recruitId, RecruitUpdate recruitUpdate);
Expand Down
Loading

0 comments on commit d6fa096

Please sign in to comment.