use of wooteco.prolog.studylog.domain.StudylogTemp in project prolog by woowacourse.
the class StudylogService method insertStudylogTemp.
@Transactional
public StudylogTempResponse insertStudylogTemp(Long memberId, StudylogRequest studylogRequest) {
Member member = memberService.findById(memberId);
Tags tags = tagService.findOrCreate(studylogRequest.getTags());
Mission mission = missionService.findById(studylogRequest.getMissionId());
StudylogTemp requestedStudylogTemp = new StudylogTemp(member, studylogRequest.getTitle(), studylogRequest.getContent(), mission, tags.getList());
deleteStudylogTemp(memberId);
StudylogTemp createdStudylogTemp = studylogTempRepository.save(requestedStudylogTemp);
return StudylogTempResponse.from(createdStudylogTemp);
}
Aggregations