Search in sources :

Example 1 with StudylogTemp

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);
}
Also used : Mission(wooteco.prolog.session.domain.Mission) LoginMember(wooteco.prolog.login.ui.LoginMember) Member(wooteco.prolog.member.domain.Member) Tags(wooteco.prolog.studylog.domain.Tags) StudylogTemp(wooteco.prolog.studylog.domain.StudylogTemp) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Transactional (org.springframework.transaction.annotation.Transactional)1 LoginMember (wooteco.prolog.login.ui.LoginMember)1 Member (wooteco.prolog.member.domain.Member)1 Mission (wooteco.prolog.session.domain.Mission)1 StudylogTemp (wooteco.prolog.studylog.domain.StudylogTemp)1 Tags (wooteco.prolog.studylog.domain.Tags)1