-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 타임라인 관련 API 의 응답 부분을 수정했습니다. - CareerEtc 엔티티를 추가했습니다. - CareerEtc 생성, 수정, 삭제 API를 추가했습니다.
- Loading branch information
Showing
13 changed files
with
407 additions
and
129 deletions.
There are no files selected for viewing
This file contains 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
142 changes: 142 additions & 0 deletions
142
src/main/java/umc/kkijuk/server/career/controller/CareerSearchController.java
This file contains 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,142 @@ | ||
package umc.kkijuk.server.career.controller; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
import umc.kkijuk.server.career.controller.response.*; | ||
import umc.kkijuk.server.career.service.BaseCareerService; | ||
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 java.util.List; | ||
|
||
@Tag(name="Search Career", description = "활동 조회 및 검색 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/career") | ||
public class CareerSearchController { | ||
private final BaseCareerService baseCareerService; | ||
private final MemberService memberService; | ||
@GetMapping("") | ||
@Operation( | ||
summary = "활동 목록", | ||
description = "활동을 조회합니다. query 값으로 category(카테고리 기준), year(연도 기준), 또는 all(전체 조회) 중 하나를 선택하여 요청해주세요." ) | ||
public CareerResponse<?> findAllCareersGroupedYear( | ||
@Login LoginInfo loginInfo, | ||
@RequestParam(name="status") String value | ||
) { | ||
Member requestMember = memberService.getById(loginInfo.getMemberId()); | ||
if(value.equals("category")){ | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_FINDALL_SUCCESS, | ||
baseCareerService.findAllCareerGroupedCategory(requestMember.getId()) | ||
); | ||
}else if (value.equals("all")){ | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_FINDALL_SUCCESS, | ||
baseCareerService.findAllCareer(requestMember.getId()) | ||
); | ||
} | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_FINDALL_SUCCESS, | ||
baseCareerService.findAllCareerGroupedYear(requestMember.getId()) | ||
); | ||
} | ||
@GetMapping("/{type}/{careerId}") | ||
@Operation(summary = "활동 상세", description = "활동 ID에 해당하는 활동의 세부 내용과, 활동 기록을 조회합니다.") | ||
@Parameter(name = "careerId", description = "활동 Id, path variable 입니다.", example = "1") | ||
public CareerResponse<BaseCareerResponse> findCareer( | ||
@Login LoginInfo loginInfo, | ||
@PathVariable String type, | ||
@PathVariable Long careerId | ||
){ | ||
Member requestMember = memberService.getById(loginInfo.getMemberId()); | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_FINDALL_SUCCESS, | ||
baseCareerService.findCareer(requestMember, careerId, type) | ||
); | ||
} | ||
@GetMapping("/find/detail") | ||
@Operation( | ||
summary = "활동 검색 - 활동 기록", | ||
description = "활동기록을 주어진 조건에 맞추어 조회합니다. query 값으로 검색어(keyword)와 정렬 기준(new,old)을 요청해주세요. " ) | ||
public CareerResponse<List<FindDetailResponse>> findDetail( | ||
@Login LoginInfo loginInfo, | ||
@RequestParam(name="keyword")String keyword, | ||
@RequestParam(name="sort") String sort | ||
) { | ||
Member reqeustMember = memberService.getById(loginInfo.getMemberId()); | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_FINDALL_SUCCESS, | ||
baseCareerService.findAllDetail(reqeustMember,keyword,sort) | ||
); | ||
} | ||
|
||
@GetMapping("/find/taglist") | ||
@Operation( | ||
summary = "활동 검색 - 태그 ( 검색 태그 조회 )", | ||
description = "검색어를 포함하는 활동 태그들을 가나다 순으로 조회합니다. " + | ||
"query 값으로 검색어(keyword)를 요청해주세요. " ) | ||
public CareerResponse<List<FindTagResponse>> findTag( | ||
@Login LoginInfo loginInfo, | ||
@RequestParam(name="keyword")String keyword | ||
) { | ||
Member requestMember = memberService.getById(loginInfo.getMemberId()); | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_SEARCH_SUCCESS, | ||
baseCareerService.findAllTag(requestMember, keyword) | ||
); | ||
} | ||
|
||
@GetMapping("/find/tag") | ||
@Operation( | ||
summary = "활동 검색 - 태그 ( 선택한 태그에 대한 활동 기록 조회 )", | ||
description = "선택한 태그를 포함하는 활동 기록들을 조회합니다. " + | ||
" query 값으로 태그의 ID 와 정렬 기준(new,old)을 요청해주세요. " ) | ||
public CareerResponse<List<FindDetailResponse>> findTagAndDetail( | ||
@Login LoginInfo loginInfo, | ||
@RequestParam(name="tagId") Long tagId, | ||
@RequestParam(name="sort") String sort | ||
){ | ||
Member requestMember = memberService.getById(loginInfo.getMemberId()); | ||
return CareerResponse.success( | ||
CareerResponseMessage.CAREER_FINDALL_SUCCESS, | ||
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) | ||
); | ||
|
||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/umc/kkijuk/server/career/controller/response/CategoryResponse.java
This file contains 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,15 @@ | ||
package umc.kkijuk.server.career.controller.response; | ||
|
||
import lombok.*; | ||
|
||
@Data | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
public class CategoryResponse { | ||
private int categoryId; | ||
private String categoryKoName; | ||
private String categoryEnName; | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/umc/kkijuk/server/career/controller/response/EtcResponse.java
This file contains 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,51 @@ | ||
package umc.kkijuk.server.career.controller.response; | ||
|
||
import lombok.*; | ||
import umc.kkijuk.server.career.domain.CareerEtc; | ||
import umc.kkijuk.server.detail.controller.response.BaseCareerDetailResponse; | ||
import umc.kkijuk.server.detail.domain.BaseCareerDetail; | ||
import umc.kkijuk.server.detail.domain.CareerType; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Data | ||
@Getter | ||
@Setter | ||
@Builder | ||
@AllArgsConstructor | ||
public class EtcResponse implements BaseCareerResponse{ | ||
private Long id; | ||
private String category; | ||
private String name; | ||
private String alias; | ||
private Boolean unknown; | ||
private String summary; | ||
private LocalDate startdate; | ||
private LocalDate enddate; | ||
private List<BaseCareerDetailResponse> detailList; | ||
|
||
public EtcResponse(CareerEtc etc) { | ||
this.id = etc.getId(); | ||
this.category = CareerType.ETC.getDescription(); | ||
this.name = etc.getName(); | ||
this.alias = etc.getAlias(); | ||
this.unknown = etc.getUnknown(); | ||
this.summary = etc.getSummary(); | ||
this.startdate = etc.getStartdate(); | ||
this.enddate = etc.getEnddate(); | ||
} | ||
|
||
public EtcResponse(CareerEtc etc, List<BaseCareerDetail> details) { | ||
this(etc); | ||
this.detailList = details.stream() | ||
.map(BaseCareerDetailResponse::new) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public LocalDate getEndDate() { | ||
return null; | ||
} | ||
} |
Oops, something went wrong.