Skip to content

Commit

Permalink
Feat [#10] 서비스 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
chaentopia committed May 18, 2024
1 parent 9b08c0a commit 2953edb
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 2953edb

Please sign in to comment.