Skip to content

Commit

Permalink
Merge pull request #157 from inje-megabrain/feat/notiCascade
Browse files Browse the repository at this point in the history
notification cascade
  • Loading branch information
mjh000526 authored Mar 26, 2024
2 parents 8a8f29c + f68cbde commit 350fb87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ public interface NotificationRepository extends JpaRepository<Notification,Long>

List<Notification> findAllByReceiver(Member member);

void deleteAllByNotObjectIdAndNotType(Long notObjectId,String notType);


}
1 change: 1 addition & 0 deletions src/main/java/com/example/just/Service/CommentService.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public ResponseEntity<String> deleteComment(Long postId, Long commentId, Long me
postDocument.setCommentSize(postDocument.getCommentSize() - 1);
postContentESRespository.save(postDocument);
commentRepository.deleteById(commentId);
notificationRepository.deleteAllByNotObjectIdAndNotType(commentId,"comment");
return ResponseEntity.ok("ok");
} else {
return ResponseEntity.status(403).body("권한이 없습니다.");
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/example/just/Service/PostService.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.example.just.Repository.HashTagESRepository;
import com.example.just.Repository.HashTagMapRepository;
import com.example.just.Repository.NotificationRepository;
import com.example.just.Repository.PostLikeRepository;
import com.example.just.Response.ResponseGetMemberPostDto;
import com.example.just.Response.ResponsePutPostDto;
Expand Down Expand Up @@ -71,6 +72,9 @@ public class PostService {

@Autowired
private HashTagESRepository hashTagESRepository;

@Autowired
private NotificationRepository notificationRepository;
@Autowired
private BlameRepository blameRepository;
@Autowired
Expand Down Expand Up @@ -527,6 +531,7 @@ public void deletePost(Long post_id) throws NotFoundException {
postContentESRespository.deleteById(post_id);
deleteHashTag(post);
postRepository.deleteById(post_id);
notificationRepository.deleteAllByNotObjectIdAndNotType(post_id,"post");
}
}
}

0 comments on commit 350fb87

Please sign in to comment.