Skip to content

Commit

Permalink
Merge branch 'develop' into feature/recruit-search
Browse files Browse the repository at this point in the history
  • Loading branch information
tape4 authored Nov 8, 2024
2 parents 9b72c7b + 0eba0da commit f2d5c05
Show file tree
Hide file tree
Showing 16 changed files with 527 additions and 446 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ out/
/nbdist/
/.nb-gradle/

### VS Code ###
### VS Code ###*
.vscode/
.DS_Store

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import org.springframework.web.bind.annotation.*;
import umc.kkijuk.server.common.LoginUser;
import umc.kkijuk.server.introduce.common.BaseResponse;
import umc.kkijuk.server.introduce.controller.response.IntroduceListResponse;
import umc.kkijuk.server.introduce.controller.response.IntroduceResponse;
import umc.kkijuk.server.introduce.dto.*;
import umc.kkijuk.server.introduce.service.IntroduceService;
import umc.kkijuk.server.login.argumentresolver.Login;
Expand Down Expand Up @@ -36,10 +38,10 @@ public ResponseEntity<Object> save(
@Login LoginInfo loginInfo,
@PathVariable("recruitId") Long recruitId, @RequestBody IntroduceReqDto introduceReqDto){
Member requestMember = memberService.getById(loginInfo.getMemberId());
IntroduceResDto introduceResDto = introduceService.saveIntro(requestMember, recruitId, introduceReqDto);
IntroduceResponse introduceResponse = introduceService.saveIntro(requestMember, recruitId, introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 생성 완료", introduceResDto));
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 생성 완료", introduceResponse));
}

@GetMapping("detail/{introId}")
Expand All @@ -48,20 +50,20 @@ public ResponseEntity<Object> get(
@Login LoginInfo loginInfo,
@PathVariable("introId") Long introId){
Member requestMember = memberService.getById(loginInfo.getMemberId());
IntroduceResDto introduceResDto = introduceService.getIntro(requestMember, introId);
IntroduceResponse introduceResponse = introduceService.getIntro(requestMember, introId);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 조회 완료", introduceResDto));
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 조회 완료", introduceResponse));
}

@GetMapping("list")
@Operation(summary = "자기소개서 목록 조회")
public ResponseEntity<Object> getList(@Login LoginInfo loginInfo){
Member requestMember = memberService.getById(loginInfo.getMemberId());
List<IntroduceListResDto> introduceListResDtos = introduceService.getIntroList(requestMember);
List<IntroduceListResponse> introduceListResponses = introduceService.getIntroList(requestMember);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 목록 조회 완료", introduceListResDtos));
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 목록 조회 완료", introduceListResponses));
}

@PatchMapping("/{introId}")
Expand All @@ -70,10 +72,10 @@ public ResponseEntity<Object> update(
@Login LoginInfo loginInfo,
@PathVariable("introId") Long introId, @RequestBody IntroduceReqDto introduceReqDto) throws Exception {
Member requestMember = memberService.getById(loginInfo.getMemberId());
IntroduceResDto introduceResDto = introduceService.updateIntro(requestMember, introId, introduceReqDto);
IntroduceResponse introduceResponse = introduceService.updateIntro(requestMember, introId, introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 수정 완료", introduceResDto));
.body(new BaseResponse<>(HttpStatus.OK.value(), "자기소개서 수정 완료", introduceResponse));
}

@DeleteMapping("/{introId}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
import org.springframework.web.bind.annotation.*;
import umc.kkijuk.server.common.LoginUser;
import umc.kkijuk.server.introduce.common.BaseResponse;
import umc.kkijuk.server.introduce.controller.response.IntroduceResponse;
import umc.kkijuk.server.introduce.controller.response.MasterIntroduceResponse;
import umc.kkijuk.server.introduce.dto.IntroduceReqDto;
import umc.kkijuk.server.introduce.dto.MasterIntroduceReqDto;
import umc.kkijuk.server.introduce.dto.MasterIntroduceResDto;
import umc.kkijuk.server.introduce.service.MasterIntroduceService;
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 = "master", description = "마스터 자기소개서 API")
@RestController
Expand All @@ -33,38 +34,32 @@ public class MasterIntroduceController {

@PostMapping
@Operation(summary = "마스터 자기소개서 생성")
public ResponseEntity<Object> save(
@Login LoginInfo loginInfo,
@RequestBody MasterIntroduceReqDto masterIntroduceReqDto) throws Exception {
Member requestMember = memberService.getById(loginInfo.getMemberId());
MasterIntroduceResDto masterIntroduceResDto =
masterIntroduceService.saveMasterIntro(requestMember, masterIntroduceReqDto);
public ResponseEntity<Object> saveMasterIntro(@Login LoginInfo loginInfo,
@RequestBody IntroduceReqDto introduceReqDto) throws Exception {
MasterIntroduceResponse masterIntroduceResponse =
masterIntroduceService.saveMasterIntro(loginInfo.getMemberId(), introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 생성 완료", masterIntroduceResDto));
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 생성 완료", masterIntroduceResponse));
}

@GetMapping
@Operation(summary = "마스터 자기소개서 조회")
public ResponseEntity<Object> get(@Login LoginInfo loginInfo){
Member requestMember = memberService.getById(loginInfo.getMemberId());
MasterIntroduceResDto masterIntroduce = masterIntroduceService.getMasterIntro(requestMember);
public ResponseEntity<Object> getMasterIntro(@Login LoginInfo loginInfo){
MasterIntroduceResponse masterIntroduceResponse = masterIntroduceService.getMasterIntro(loginInfo.getMemberId());
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 조회 완료", masterIntroduce));
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 조회 완료", masterIntroduceResponse));
}

@PatchMapping
@Operation(summary = "마스터 자기소개서 수정")
public ResponseEntity<Object> update(
@Login LoginInfo loginInfo,
Long id, @RequestBody MasterIntroduceReqDto masterIntroduceReqDto) throws Exception {
Member requestMember = memberService.getById(loginInfo.getMemberId());
MasterIntroduceResDto masterIntroduceResDto =
masterIntroduceService.updateMasterIntro(requestMember, id, masterIntroduceReqDto);
public ResponseEntity<Object> updateMasterIntro(
@Login LoginInfo loginInfo, @RequestBody IntroduceReqDto introduceReqDto) throws Exception {
MasterIntroduceResponse masterIntroduceResponse = masterIntroduceService.updateMasterIntro(loginInfo.getMemberId(), introduceReqDto);
return ResponseEntity
.status(HttpStatus.OK)
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 수정 완료", masterIntroduceResDto));
.body(new BaseResponse<>(HttpStatus.OK.value(), "마스터 자기소개서 수정 완료", masterIntroduceResponse));
}

}
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
package umc.kkijuk.server.introduce.dto;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import umc.kkijuk.server.introduce.domain.Introduce;
import umc.kkijuk.server.member.domain.Member;

import java.time.LocalDateTime;
import java.time.Duration;
import java.time.format.DateTimeFormatter;

@Getter
@Setter
public class IntroduceListResDto {
private Long id;
private Long memberId;
private Long recruitId;
private String recruitTitle;
private String deadline;
private String updatedAt;
private String timeSinceUpdate;
private int state;

@Builder
public IntroduceListResDto(Introduce introduce) {
this.id = introduce.getId();
this.memberId = introduce.getMemberId();
this.recruitId=introduce.getRecruit().toModel().getId();
this.recruitTitle=introduce.getRecruit().toModel().getTitle();
this.deadline=formatUpdatedAt(introduce.getRecruit().toModel().getEndTime());
this.updatedAt = formatUpdatedAt(introduce.getUpdatedAt());
this.timeSinceUpdate = calculateTimeUntilDeadline(introduce.getUpdatedAt(), introduce.getRecruit().toModel().getEndTime());
this.state=introduce.getState();
}

private String formatUpdatedAt(LocalDateTime updatedAt) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return updatedAt != null ? updatedAt.format(formatter) : null;
}

private String calculateTimeUntilDeadline(LocalDateTime updatedAt, LocalDateTime deadline) {
Duration duration = Duration.between(updatedAt, deadline);
long days = duration.toDays() + 1;
return "D-" + days;
}
}
package umc.kkijuk.server.introduce.controller.response;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import umc.kkijuk.server.introduce.domain.Introduce;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Getter
@Setter
public class IntroduceListResponse {
private Long id;
private Long memberId;
private Long recruitId;
private String recruitTitle;
private String deadline;
private String updatedAt;
private String timeSinceUpdate;
private int state;

@Builder
public IntroduceListResponse(Introduce introduce) {
this.id = introduce.getId();
this.memberId = introduce.getMemberId();
this.recruitId=introduce.getRecruit().toModel().getId();
this.recruitTitle=introduce.getRecruit().toModel().getTitle();
this.deadline=formatUpdatedAt(introduce.getRecruit().toModel().getEndTime());
this.updatedAt = formatUpdatedAt(introduce.getUpdatedAt());
this.timeSinceUpdate = calculateTimeUntilDeadline(introduce.getUpdatedAt(), introduce.getRecruit().toModel().getEndTime());
this.state=introduce.getState();
}

private String formatUpdatedAt(LocalDateTime updatedAt) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return updatedAt != null ? updatedAt.format(formatter) : null;
}

private String calculateTimeUntilDeadline(LocalDateTime updatedAt, LocalDateTime deadline) {
Duration duration = Duration.between(updatedAt, deadline);
long days = duration.toDays() + 1;
return "D-" + days;
}
}
Original file line number Diff line number Diff line change
@@ -1,58 +1,56 @@
package umc.kkijuk.server.introduce.dto;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import umc.kkijuk.server.introduce.domain.Introduce;
import umc.kkijuk.server.member.domain.Member;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.stream.Collectors;

@Getter
@Setter
public class IntroduceResDto {
private Long id;
private Long recruitId;
private Long memberId;
private String recruitTitle;
private List<QuestionDto> questionList;
private String deadline;
private List<String> tags;
private String link;
private String updatedAt;
private String timeSinceUpdate;
/* private List<String> introduceList;*/
private int state;

@Builder
public IntroduceResDto(Introduce introduce, List<QuestionDto> questionList/*, List<String> introduceList*/) {
this.id = introduce.getId();
this.recruitId=introduce.getRecruit().toModel().getId();
this.memberId=introduce.getMemberId();
this.recruitTitle=introduce.getRecruit().toModel().getTitle();
this.questionList = questionList;
this.deadline=formatUpdatedAt(introduce.getRecruit().toModel().getEndTime());
this.tags=introduce.getRecruit().toModel().getTags();
this.link=introduce.getRecruit().toModel().getLink();
this.updatedAt = formatUpdatedAt(introduce.getUpdatedAt());
this.timeSinceUpdate = calculateTimeUntilDeadline(introduce.getUpdatedAt(), introduce.getRecruit().toModel().getEndTime());
/*this.introduceList = introduceList;*/
this.state=introduce.getState();
}

private String formatUpdatedAt(LocalDateTime updatedAt) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return updatedAt != null ? updatedAt.format(formatter) : null;
}

private String calculateTimeUntilDeadline(LocalDateTime updatedAt, LocalDateTime deadline) {
Duration duration = Duration.between(updatedAt, deadline);
long days = duration.toDays() + 1;
return "D-" + days;
}

}
package umc.kkijuk.server.introduce.controller.response;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import umc.kkijuk.server.introduce.domain.Introduce;
import umc.kkijuk.server.introduce.dto.QuestionDto;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

@Getter
@Setter
public class IntroduceResponse {
private Long id;
private Long recruitId;
private Long memberId;
private String recruitTitle;
private List<QuestionDto> questionList;
private String deadline;
private List<String> tags;
private String link;
private String updatedAt;
private String timeSinceUpdate;
/* private List<String> introduceList;*/
private int state;

@Builder
public IntroduceResponse(Introduce introduce, List<QuestionDto> questionList/*, List<String> introduceList*/) {
this.id = introduce.getId();
this.recruitId=introduce.getRecruit().toModel().getId();
this.memberId=introduce.getMemberId();
this.recruitTitle=introduce.getRecruit().toModel().getTitle();
this.questionList = questionList;
this.deadline=formatUpdatedAt(introduce.getRecruit().toModel().getEndTime());
this.tags=introduce.getRecruit().toModel().getTags();
this.link=introduce.getRecruit().toModel().getLink();
this.updatedAt = formatUpdatedAt(introduce.getUpdatedAt());
this.timeSinceUpdate = calculateTimeUntilDeadline(introduce.getUpdatedAt(), introduce.getRecruit().toModel().getEndTime());
/*this.introduceList = introduceList;*/
this.state=introduce.getState();
}

private String formatUpdatedAt(LocalDateTime updatedAt) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return updatedAt != null ? updatedAt.format(formatter) : null;
}

private String calculateTimeUntilDeadline(LocalDateTime updatedAt, LocalDateTime deadline) {
Duration duration = Duration.between(updatedAt, deadline);
long days = duration.toDays() + 1;
return "D-" + days;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package umc.kkijuk.server.introduce.controller.response;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import umc.kkijuk.server.introduce.domain.Introduce;
import umc.kkijuk.server.introduce.domain.MasterIntroduce;
import umc.kkijuk.server.introduce.dto.QuestionDto;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

@Getter
@Setter
public class MasterIntroduceResponse {
private Long id;
private Long memberId;
private List<QuestionDto> questionList;
private String updatedAt;
private int state;

@Builder
public MasterIntroduceResponse(MasterIntroduce masterIntroduce, List<QuestionDto> questionList) {
this.id = masterIntroduce.getId();
this.memberId=masterIntroduce.getMemberId();
this.questionList = questionList;
this.updatedAt = formatUpdatedAt(masterIntroduce.getUpdatedAt());
this.state=masterIntroduce.getState();
}

private String formatUpdatedAt(LocalDateTime updatedAt) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
return updatedAt != null ? updatedAt.format(formatter) : null;
}

}
Loading

0 comments on commit f2d5c05

Please sign in to comment.