From 2953edb705a00028d97caf49d34eda14dfbf9776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=B1=84=EC=9D=80?= Date: Sun, 19 May 2024 04:08:47 +0900 Subject: [PATCH] =?UTF-8?q?Feat=20[#10]=20=EC=84=9C=EB=B9=84=EC=8A=A4=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jumpit/resume/service/ResumeService.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 jumpit/src/main/java/org/sopt/jumpit/resume/service/ResumeService.java diff --git a/jumpit/src/main/java/org/sopt/jumpit/resume/service/ResumeService.java b/jumpit/src/main/java/org/sopt/jumpit/resume/service/ResumeService.java new file mode 100644 index 0000000..d343c9f --- /dev/null +++ b/jumpit/src/main/java/org/sopt/jumpit/resume/service/ResumeService.java @@ -0,0 +1,30 @@ +package org.sopt.jumpit.resume.service; + +import jakarta.transaction.Transactional; +import lombok.RequiredArgsConstructor; +import org.sopt.jumpit.global.common.dto.message.ErrorMessage; +import org.sopt.jumpit.global.exception.BusinessException; +import org.sopt.jumpit.resume.domain.Resume; +import org.sopt.jumpit.resume.dto.ResumeCreateRequest; +import org.sopt.jumpit.resume.repository.ResumeRepository; +import org.sopt.jumpit.user.domain.User; +import org.sopt.jumpit.user.repository.UserRepository; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class ResumeService { + private final ResumeRepository resumeRepository; + private final UserRepository userRepository; + + @Transactional + public void createResume( + ResumeCreateRequest resumeCreateRequest + ) { + User findUser = userRepository.findById(resumeCreateRequest.userId()).orElseThrow( + () -> new BusinessException(ErrorMessage.SEARCH_FAILED) + ); + Resume resume = Resume.create(findUser, resumeCreateRequest.title()); + resumeRepository.save(resume); + } +}