-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: notification update read_at 메서드 unit 테스트 * test: save 3번 -> save_all 수정 * test: notification repository unit test 파일 통합 * test: 미확인 알림 조회 메서드 테스트 * feat: 미확인 알림 리스트 조회 메서드 쿼리 추가 * style: count 파라미터 순서 변경 * feat: notification service 메서드 count, bulk update 메서드 추가 * feat: notification manager 구현 * feat: 읽음 요청 dto 정의 * feat: notification 읽음 처리 controller 정의 * feat: notification update usecase & service 작성 * feat: 불필요한 user_id 파라미터 제거 * docs: swagger 문서 작성 * fix: notification service read_only 옵션 제거
- Loading branch information
1 parent
869be8d
commit 4f51e7b
Showing
9 changed files
with
168 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...i/src/main/java/kr/co/pennyway/api/apis/notification/service/NotificationSaveService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package kr.co.pennyway.api.apis.notification.service; | ||
|
||
import kr.co.pennyway.domain.domains.notification.service.NotificationService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class NotificationSaveService { | ||
private final NotificationService notificationService; | ||
|
||
/** | ||
* 알림 목록을 읽음 상태로 업데이트합니다. | ||
* | ||
* @param notificationIds 읽음 처리할 알림 ID 목록 | ||
*/ | ||
public void updateNotificationsToRead(List<Long> notificationIds) { | ||
notificationService.updateReadAtByIdsInBulk(notificationIds); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...i/src/main/java/kr/co/pennyway/api/common/security/authorization/NotificationManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package kr.co.pennyway.api.common.security.authorization; | ||
|
||
import kr.co.pennyway.domain.domains.notification.service.NotificationService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@Component("notificationManager") | ||
@RequiredArgsConstructor | ||
public class NotificationManager { | ||
private final NotificationService notificationService; | ||
|
||
/** | ||
* 사용자가 알림 리스트에 대한 전체 접근 권한이 있는지 확인한다. | ||
* <p> | ||
* 조회 결과와 요청 파라미터의 개수가 동일해야 하며, 읽음 상태의 알림은 포함되어선 안 된다. | ||
*/ | ||
@Transactional(readOnly = true) | ||
public boolean hasPermission(Long userId, List<Long> notificationIds) { | ||
return notificationService.countUnreadNotifications(userId, notificationIds) == (long) notificationIds.size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters