Skip to content

Commit

Permalink
Merge pull request #53 from kookmin-sw/feat/debug
Browse files Browse the repository at this point in the history
debug: 자기소개서 디버깅
  • Loading branch information
KimChanJin97 authored May 8, 2024
2 parents de6dd22 + 03dd6e6 commit a5c06a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;


@Slf4j
Expand All @@ -30,10 +24,9 @@ public class ResumeController {
@PostMapping(value = "/my-resume")
public ResponseEntity<ResumePostPutResponse> postMyResume(
@AuthMember Long memberId,
@RequestPart("images") List<MultipartFile> images,
@RequestPart("resumeRequest") ResumeRequest request
@ModelAttribute ResumePostPutRequest request
) throws IOException {
return ResponseEntity.ok(resumeService.postMyResume(memberId, images, request));
return ResponseEntity.ok(resumeService.postMyResume(memberId, request));
}

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

@DeleteMapping("/my-resume")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package capstone.facefriend.resume.domain.dto;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public record ResumePostPutRequest(
List<MultipartFile> images,
List<String> categories,
String content
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
Expand All @@ -39,15 +38,14 @@ public class ResumeService {
// 정적 쿼리
public ResumePostPutResponse postMyResume(
Long memberId,
List<MultipartFile> images,
ResumeRequest request
ResumePostPutRequest request
) throws IOException {

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

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

Resume resume = Resume.builder()
.member(member)
Expand Down Expand Up @@ -116,8 +114,7 @@ public ResumeGetResponse getMyResume(
@Transactional
public ResumePostPutResponse putMyResume(
Long memberId,
List<MultipartFile> images,
ResumeRequest request
ResumePostPutRequest request
) throws IOException {

validateCategories(request.categories());
Expand All @@ -126,7 +123,7 @@ public ResumePostPutResponse putMyResume(
Member me = findMemberById(memberId);
Resume mine = findResumeByMember(me); // 영속 상태

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

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

0 comments on commit a5c06a1

Please sign in to comment.