From 186a08b30fb50803d71ce84786be7b12da706a7e Mon Sep 17 00:00:00 2001 From: comolove Date: Mon, 13 Nov 2023 00:32:57 +0900 Subject: [PATCH] fix: refix update series info --- .../post/memo/repository/MemoRepositoryJdbc.java | 2 +- .../domain/post/memo/service/MemoService.java | 2 +- .../memo/repository/MemoRepositoryJdbcTest.java | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbc.java b/src/main/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbc.java index 75eb38f7..7551f341 100644 --- a/src/main/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbc.java +++ b/src/main/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbc.java @@ -298,7 +298,7 @@ public void updateSeriesIdAndTitle(Long seriesId, String seriesTitle, Long autho for (Long memoId : memoIdList) { String sql = "UPDATE post.memo " + "SET series_id = ?, series_title = ?, series_order = nextval('post.memo_series_order_seq'::regclass) " + - "WHERE id = ? and author_id = ? and is_temporary = false"; + "WHERE id = ? and author_id = ?"; updatedRows += template.update(sql, seriesId, seriesTitle, memoId, authorId); } diff --git a/src/main/java/Funssion/Inforum/domain/post/memo/service/MemoService.java b/src/main/java/Funssion/Inforum/domain/post/memo/service/MemoService.java index 5e08ee48..960e3959 100644 --- a/src/main/java/Funssion/Inforum/domain/post/memo/service/MemoService.java +++ b/src/main/java/Funssion/Inforum/domain/post/memo/service/MemoService.java @@ -207,6 +207,7 @@ public MemoDto updateMemo(Long memoId, MemoSaveDto form) { checkUpdatableMemo(willBeUpdatedMemo, form); updateHistory(form, userId, willBeUpdatedMemo); + updateSeriesInfo(form.getSeriesId(), form.getSeriesTitle(), willBeUpdatedMemo); try { tagRepository.updateTags(memoId,updatedTags); } catch (SQLException e) { @@ -227,7 +228,6 @@ private void updateHistory(MemoSaveDto form, Long userId, Memo willBeUpdatedMemo // 임시글 -> 등록 if (willBeUpdatedMemo.getIsTemporary()) { - updateSeriesInfo(form.getSeriesId(), form.getSeriesTitle(), willBeUpdatedMemo); createOrUpdateHistory(userId, willBeUpdatedMemo.getCreatedDate(), PLUS); sendNotificationToFollowerAndEmployer(userId, willBeUpdatedMemo); scoreService.checkUserDailyScoreAndAdd(userId,ScoreType.MAKE_MEMO, willBeUpdatedMemo.getId()); diff --git a/src/test/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbcTest.java b/src/test/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbcTest.java index 1573d821..3a8da4a8 100644 --- a/src/test/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbcTest.java +++ b/src/test/java/Funssion/Inforum/domain/post/memo/repository/MemoRepositoryJdbcTest.java @@ -230,14 +230,14 @@ void exUpdateAnotherMemo() { .isInstanceOf(UpdateFailException.class); } - @Test - @DisplayName("임시 저장중인 메모를 시리즈로 생성") - void texUpdateTemporaryMemo() { - List testMemoIdList = List.of(createdMemo3.getId(), createdMemo4.getId()); - - assertThatThrownBy(() -> repository.updateSeriesIdAndTitle(testSeriesId, testSeriesTitle1, userId2, testMemoIdList)) - .isInstanceOf(UpdateFailException.class); - } +// @Test +// @DisplayName("임시 저장중인 메모를 시리즈로 생성") +// void texUpdateTemporaryMemo() { +// List testMemoIdList = List.of(createdMemo3.getId(), createdMemo4.getId()); +// +// assertThatThrownBy(() -> repository.updateSeriesIdAndTitle(testSeriesId, testSeriesTitle1, userId2, testMemoIdList)) +// .isInstanceOf(UpdateFailException.class); +// } @Test @DisplayName("메모 시리즈에서 삭제")