Skip to content

Commit b7e74f0

Browse files
authored
Merge pull request #183 from dnd-side-project/feature/#182-empty-template
feat : memo 생성/수정 시 templateId = 0일 때의 로직 추가
2 parents 927faa3 + 2458295 commit b7e74f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/com/dnd/reevserver/domain/memo/service/MemoService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public CreateMemoResponseDto createMemo(String userId, CreateMemoRequestDto dto)
7373
.title(dto.title())
7474
.content(dto.content())
7575
.team(dto.groupId() == null ? null : teamService.findById(dto.groupId())) // null 가능
76-
.template(templateService.findById(dto.templateId()))
76+
.template(dto.templateId() == 0 ? null : templateService.findById(dto.templateId()))
7777
.build();
7878
// 메모-태그 생성
7979
memoRepository.save(memo);
@@ -97,7 +97,9 @@ public UpdateMemoResponseDto updateMemo(String userId, UpdateMemoRequestDto dto)
9797
memo.updateTitle(dto.title());
9898
memo.updateContent(dto.content());
9999
memo.updateTeam(dto.groupId() == null ? null : teamService.findById(dto.groupId()));
100-
memo.updateTemplate(templateService.findById(dto.templateId()));
100+
101+
if(dto.templateId() != 0)
102+
memo.updateTemplate(templateService.findById(dto.templateId()));
101103

102104
memoRepository.deleteAllByMemo(memo);
103105
memo.clearMemoCategory();

0 commit comments

Comments
 (0)