-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNotificationService.java
More file actions
56 lines (51 loc) · 2.34 KB
/
NotificationService.java
File metadata and controls
56 lines (51 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.chooz.notification.application;
import com.chooz.common.dto.CursorBasePaginatedResponse;
import com.chooz.notification.application.dto.TargetPostDto;
import com.chooz.notification.application.dto.TargetUserDto;
import com.chooz.notification.application.service.NotificationCommandService;
import com.chooz.notification.application.service.NotificationQueryService;
import com.chooz.notification.domain.Notification;
import com.chooz.notification.presentation.dto.NotificationPresentResponse;
import com.chooz.notification.presentation.dto.NotificationResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class NotificationService {
private final NotificationQueryService notificationQueryService;
private final NotificationCommandService notificationCommandService;
public CursorBasePaginatedResponse<NotificationResponse> findNotifications(Long userId, Long cursor, int size) {
return notificationQueryService.findNotifications(userId, cursor, size);
}
public TargetUserDto findUserByCommentId(Long commentId) {
return notificationQueryService.findUserByCommentId(commentId);
}
public TargetUserDto findUserById(Long userId) {
return notificationQueryService.findUserById(userId);
}
public TargetPostDto findPostByCommentId(Long commentId) {
return notificationQueryService.findPostByCommentId(commentId);
}
public TargetUserDto findUserByPostId(Long postId) {
return notificationQueryService.findUserByPostId(postId);
}
public TargetPostDto findPostById(Long postId) {
return notificationQueryService.findPostById(postId);
}
public Notification create(Notification notification) {
return notificationCommandService.create(notification);
}
public void createAll(List<Notification> notifications) {
notificationCommandService.createAll(notifications);
}
public List<TargetUserDto> findVoteUsersByPostId(Long postId) {
return notificationQueryService.findVoteUsersByPostId(postId);
}
public void markRead(Long notificationId) {
notificationCommandService.markRead(notificationId);
}
public NotificationPresentResponse present(Long userId) {
return notificationQueryService.present(userId);
}
}