Skip to content

Commit

Permalink
Merge pull request #135 from zanzanbari/hotfix/134
Browse files Browse the repository at this point in the history
hotfix : 맀일 00μ‹œ TodayWal μ—…λ°μ΄νŠΈ μ‹œ NextWal 이 μ œλŒ€λ‘œ update λ˜μ§€ μ•ŠλŠ” 였λ₯˜ #134
  • Loading branch information
oownahcohc authored Aug 27, 2023
2 parents ffb56d7 + dd92764 commit 7e2a38e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void updateNextWal(NextWals nextWals, NextWal randomNextWal, WalCategoryT
Long countOfCorrespondCategoryType = itemRepository.countAllByCategoryCategoryType(categoryType);
double nextItemId = nextWals.calculateNextItemId(randomNextWal, countOfCorrespondCategoryType);
Item nextItem = itemRepository.findByCategoryCategoryTypeAndCategoryItemNumber(categoryType, nextItemId);
nextWalRepository.updateNextWalItem(randomNextWal.getId(), nextItem);
randomNextWal.updateItem(nextItem);
nextWals.updateNextWalInfo(randomNextWal);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package backend.wal.wal.nextwal.domain.repository;

import backend.wal.wal.common.domain.WalCategoryType;
import backend.wal.wal.nextwal.domain.aggregate.Item;
import backend.wal.wal.nextwal.domain.aggregate.NextWal;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
Expand All @@ -18,5 +20,9 @@ public interface NextWalRepository extends JpaRepository<NextWal, Long> {
@Query("SELECT nw FROM NextWal nw JOIN FETCH nw.item WHERE nw.userId = :userId")
List<NextWal> findNextWalsWithItemByUserId(Long userId);

@Modifying
@Query("UPDATE NextWal nw SET nw.item = :item WHERE nw.id = :nextWalId")
void updateNextWalItem(Long nextWalId, Item item);

void deleteAllByUserId(Long userId);
}

0 comments on commit 7e2a38e

Please sign in to comment.