use of wooteco.prolog.studylog.exception.StudylogScrapNotExistException in project prolog by woowacourse.
the class StudylogScrapService method unregisterScrap.
@Transactional
public void unregisterScrap(Long memberId, Long studylogId) {
StudylogScrap scrap = studylogScrapRepository.findByMemberIdAndStudylogId(memberId, studylogId).orElseThrow(StudylogScrapNotExistException::new);
studylogScrapRepository.delete(scrap);
}
use of wooteco.prolog.studylog.exception.StudylogScrapNotExistException in project prolog by woowacourse.
the class StudylogService method checkScrapedOrRead.
private void checkScrapedOrRead(Long memberId, Long studylogId) {
if (studylogScrapRepository.existsByMemberIdAndStudylogId(memberId, studylogId)) {
StudylogScrap studylogScrap = studylogScrapRepository.findByMemberIdAndStudylogId(memberId, studylogId).orElseThrow(StudylogScrapNotExistException::new);
studylogScrapRepository.delete(studylogScrap);
}
if (studylogReadRepository.existsByMemberIdAndStudylogId(memberId, studylogId)) {
StudylogRead studylogRead = studylogReadRepository.findByMemberIdAndStudylogId(memberId, studylogId).orElseThrow(StudylogReadNotExistException::new);
studylogReadRepository.delete(studylogRead);
}
}
Aggregations