Skip to content

Commit

Permalink
feat: notification 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Sion99 committed Jun 3, 2024
1 parent 26ef89e commit 1897fb9
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.savemyreceipt.smr.infrastructure;

import com.savemyreceipt.smr.domain.Member;
import com.savemyreceipt.smr.domain.Notification;
import com.savemyreceipt.smr.exception.ErrorStatus;
import com.savemyreceipt.smr.exception.model.CustomException;
import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;

public interface NotificationRepository extends JpaRepository<Notification, Long> {

List<Notification> findByMemberAndCheckedFalse(Member member);

Optional<Notification> findById(Long id);

default Notification getNotificationById(Long id) {
return findById(id).orElseThrow(
() -> new CustomException(ErrorStatus.NOTIFICATION_NOT_FOUND, ErrorStatus.NOTIFICATION_NOT_FOUND.getMessage())
);
}

}

0 comments on commit 1897fb9

Please sign in to comment.