Skip to content

Commit

Permalink
Merge pull request #20 from TeamUStory/fix/paper-count
Browse files Browse the repository at this point in the history
fix:paperCount, 동시성 문제 해결
yungic authored Sep 12, 2024
2 parents 6368331 + 2f6a4d4 commit cd86ccf
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -222,14 +222,16 @@ public Paper validatePaper(Long paperId) {
return paper;
}

public Integer countPapersByWriterId(Long userId) {
public int countPapersByWriterId(Long userId) {
List<Paper> findByWriterId = paperRepository.findByWriterId(userId);
for(Paper paper : findByWriterId) {
if (paper.isDeleted()) {
findByWriterId.remove(paper);
int count = 0;

for (Paper paper : findByWriterId) {
if (!paper.isDeleted()) {
count++;
}
}
return findByWriterId.size();
return count;
}

// 작성자를 제외한 멤버들에게 코멘트를 달아달라고 알림 전송, 트랜잭션?

0 comments on commit cd86ccf

Please sign in to comment.