Skip to content

Commit

Permalink
fix: refix update series info
Browse files Browse the repository at this point in the history
  • Loading branch information
comolove committed Nov 12, 2023
1 parent 44bc0b2 commit 186a08b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,14 @@ void exUpdateAnotherMemo() {
.isInstanceOf(UpdateFailException.class);
}

@Test
@DisplayName("임시 저장중인 메모를 시리즈로 생성")
void texUpdateTemporaryMemo() {
List<Long> testMemoIdList = List.of(createdMemo3.getId(), createdMemo4.getId());

assertThatThrownBy(() -> repository.updateSeriesIdAndTitle(testSeriesId, testSeriesTitle1, userId2, testMemoIdList))
.isInstanceOf(UpdateFailException.class);
}
// @Test
// @DisplayName("임시 저장중인 메모를 시리즈로 생성")
// void texUpdateTemporaryMemo() {
// List<Long> testMemoIdList = List.of(createdMemo3.getId(), createdMemo4.getId());
//
// assertThatThrownBy(() -> repository.updateSeriesIdAndTitle(testSeriesId, testSeriesTitle1, userId2, testMemoIdList))
// .isInstanceOf(UpdateFailException.class);
// }

@Test
@DisplayName("메모 시리즈에서 삭제")
Expand Down

0 comments on commit 186a08b

Please sign in to comment.