Skip to content

Commit

Permalink
Merge pull request #52 from kookmin-sw/feat/debug2
Browse files Browse the repository at this point in the history
debug: 자기소개서 디버깅2
  • Loading branch information
KimChanJin97 authored May 8, 2024
2 parents a3a6591 + ce0bdd6 commit de6dd22
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public class ResumeController {
@PostMapping(value = "/my-resume")
public ResponseEntity<ResumePostPutResponse> postMyResume(
@AuthMember Long memberId,
@RequestPart("images") List<MultipartFile> images
// @RequestPart("request") ResumePostRequest request
@RequestPart("images") List<MultipartFile> images,
@RequestPart("resumeRequest") ResumeRequest request
) throws IOException {
return ResponseEntity.ok(resumeService.postMyResume(memberId, images));
return ResponseEntity.ok(resumeService.postMyResume(memberId, images, request));
}

@GetMapping("/resume")
Expand All @@ -54,10 +54,10 @@ public ResponseEntity<ResumeGetResponse> getMyResume(
@PutMapping(value = "/my-resume")
public ResponseEntity<ResumePostPutResponse> putMyResume(
@AuthMember Long memberId,
@RequestPart("images") List<MultipartFile> images
// @RequestPart("request") ResumePutRequest request
@RequestPart("images") List<MultipartFile> images,
@RequestPart("resumeRequest") ResumeRequest request
) throws IOException {
return ResponseEntity.ok(resumeService.putMyResume(memberId, images));
return ResponseEntity.ok(resumeService.putMyResume(memberId, images, request));
}

@DeleteMapping("/my-resume")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.List;

public record ResumePutRequest(
public record ResumeRequest(
List<String> categories,
String content
) {
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/capstone/facefriend/resume/service/ResumeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ public class ResumeService {
// 정적 쿼리
public ResumePostPutResponse postMyResume(
Long memberId,
List<MultipartFile> images
// ResumePostRequest request
List<MultipartFile> images,
ResumeRequest request
) throws IOException {

// validateCategories(request.categories());
// validateContent(request.content());
validateCategories(request.categories());
validateContent(request.content());
Member member = validateMemberHasResume(memberId);

List<String> resumeImagesS3url = bucketService.uploadResumeImages(images);

Resume resume = Resume.builder()
.member(member)
.resumeImageS3urls(resumeImagesS3url)
// .categories(request.categories().stream().map(str -> Category.valueOf(str)).collect(Collectors.toSet()))
// .content(request.content())
.categories(request.categories().stream().map(str -> Category.valueOf(str)).collect(Collectors.toSet()))
.content(request.content())
.build();
resumeRepository.save(resume);

Expand Down Expand Up @@ -116,21 +116,21 @@ public ResumeGetResponse getMyResume(
@Transactional
public ResumePostPutResponse putMyResume(
Long memberId,
List<MultipartFile> images
// ResumePutRequest request
List<MultipartFile> images,
ResumeRequest request
) throws IOException {

// validateCategories(request.categories());
// validateContent(request.content());
validateCategories(request.categories());
validateContent(request.content());

Member me = findMemberById(memberId);
Resume mine = findResumeByMember(me); // 영속 상태

List<String> resumeImageS3urls = bucketService.updateResumeImages(images, mine);

mine.setResumeImageS3urls(resumeImageS3urls); // dirty check
// mine.setCategories(request.categories().stream().map(str -> Category.valueOf(str)).collect(Collectors.toSet())); // // dirty check
// mine.setContent(request.content()); // // dirty check
mine.setCategories(request.categories().stream().map(str -> Category.valueOf(str)).collect(Collectors.toSet())); // dirty check
mine.setContent(request.content()); // dirty check

return new ResumePostPutResponse(
mine.getId(),
Expand Down

0 comments on commit de6dd22

Please sign in to comment.