-
Notifications
You must be signed in to change notification settings - Fork 0
[CMAT-58] feat: RecruitScrap 엔티티에 jobName 필드 추가 #39
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,31 +1,47 @@ | ||||||
| package UMC.career_mate.domain.recruitScrap.converter; | ||||||
|
|
||||||
| import UMC.career_mate.domain.job.Job; | ||||||
| import UMC.career_mate.domain.member.Member; | ||||||
| import UMC.career_mate.domain.recruit.Recruit; | ||||||
| import UMC.career_mate.domain.recruitScrap.RecruitScrap; | ||||||
| import UMC.career_mate.domain.recruitScrap.dto.response.RecruitScrapResponseDTO; | ||||||
| import UMC.career_mate.domain.recruitScrap.dto.response.RecruitScrapResponseDTO.RecruitScrapThumbNailInfoDTO; | ||||||
| import java.time.LocalDate; | ||||||
| import java.time.temporal.ChronoUnit; | ||||||
| import java.util.List; | ||||||
|
|
||||||
| public class RecruitScrapConverter { | ||||||
|
|
||||||
| public static RecruitScrap toEntity(Member member, Recruit recruit) { | ||||||
| return RecruitScrap.builder() | ||||||
| .member(member) | ||||||
| .recruit(recruit) | ||||||
| .jobName(member.getJob().getName()) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. member.getJob()에 대한 null 체크 필요
다음과 같이 수정하는 것을 권장합니다: - .jobName(member.getJob().getName())
+ .jobName(member.getJob() != null ? member.getJob().getName() : null)📝 Committable suggestion
Suggested change
|
||||||
| .build(); | ||||||
| } | ||||||
|
|
||||||
| public static RecruitScrapResponseDTO toRecruitScrapResponseDTO(Recruit recruit, String jobName) { | ||||||
| public static RecruitScrapResponseDTO toRecruitScrapResponseDTO(Job job, | ||||||
| List<RecruitScrapThumbNailInfoDTO> recruitScrapThumbNailInfoDTOList) { | ||||||
| return RecruitScrapResponseDTO.builder() | ||||||
| .recruitId(recruit.getId()) | ||||||
| .companyName(recruit.getCompanyName()) | ||||||
| .title(recruit.getTitle()) | ||||||
| .deadLine(formatDeadLine(recruit)) | ||||||
| .isScraped(true) | ||||||
| .companyInfoUrl(recruit.getCompanyInfoUrl()) | ||||||
| .recruitUrl(recruit.getRecruitUrl()) | ||||||
| .jobName(jobName) | ||||||
| .jobName(job.getName()) | ||||||
| .recruitScrapThumbNailInfoDTOList(recruitScrapThumbNailInfoDTOList) | ||||||
| .build(); | ||||||
| } | ||||||
|
|
||||||
| public static RecruitScrapThumbNailInfoDTO toRecruitScrapThumbNailInfoDTO(RecruitScrap recruitScrap) { | ||||||
| return RecruitScrapThumbNailInfoDTO.builder() | ||||||
| .recruitId(recruitScrap.getRecruit().getId()) | ||||||
| .companyName(recruitScrap.getRecruit().getCompanyName()) | ||||||
| .title(recruitScrap.getRecruit().getTitle()) | ||||||
| .deadLine(formatDeadLine(recruitScrap.getRecruit())) | ||||||
| .isScrapped(true) | ||||||
| .build(); | ||||||
| } | ||||||
|
|
||||||
| public static RecruitScrapResponseDTO toEmptyRecruitScrapResponseDTO(Job job) { | ||||||
| return RecruitScrapResponseDTO.builder() | ||||||
| .jobName(job.getName()) | ||||||
| .recruitScrapThumbNailInfoDTOList(List.of()) | ||||||
| .build(); | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,21 @@ | ||
| package UMC.career_mate.domain.recruitScrap.dto.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.util.List; | ||
| import lombok.Builder; | ||
|
|
||
| @Builder | ||
| public record RecruitScrapResponseDTO( | ||
| Long recruitId, | ||
| String companyName, | ||
| String title, | ||
| String deadLine, | ||
| boolean isScraped, | ||
| String companyInfoUrl, | ||
| String recruitUrl, | ||
| String jobName | ||
| String jobName, | ||
| List<RecruitScrapThumbNailInfoDTO> recruitScrapThumbNailInfoDTOList | ||
| ) { | ||
|
|
||
| @Builder | ||
| public record RecruitScrapThumbNailInfoDTO( | ||
| Long recruitId, | ||
| String companyName, | ||
| String title, | ||
| String deadLine, | ||
| boolean isScrapped | ||
| ){ | ||
| } | ||
| } |
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.
🛠️ Refactor suggestion
jobName 필드에 제약 조건 추가 필요
jobName필드에 대한 길이 제한이나 null 허용 여부 등의 제약 조건이 명시되어 있지 않습니다.다음과 같이 제약 조건을 추가하는 것을 권장합니다:
📝 Committable suggestion