use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class NotificationSendingController method sendNotification.
@GetMapping
public String sendNotification(Model model) {
User user = userService.getLoggedInUser().orElseThrow(() -> new AccessDeniedException("403"));
model.addAttribute("page_title", "Send Notifications");
model.addAttribute("page_subtitle", "Notification Manager");
model.addAttribute("page_description", "Send notifications to students, sections or departments");
model.addAttribute("channel_types", Arrays.asList(ChannelType.STUDENT, ChannelType.COURSE, ChannelType.TAUGHT_COURSE, ChannelType.SECTION, ChannelType.FACULTY));
if (!model.containsAttribute("notification")) {
Notification notification = new Notification();
notification.setSender(user);
model.addAttribute("notification", notification);
}
return "management/send_notification";
}
use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationRecipient.
@Test
public void saveNotificationRecipient() {
Notification notification = getNotification();
setBehaviour();
notificationSendingService.sendNotification(notification);
Stream.of(userIds).forEach(id -> verify(cachedNotificationService).resetUnreadCount(id));
List<NotificationRecipient> recipients = getRecipients();
verify(emailSendingService).sendEmailForNotification(notification, userList);
recipients.forEach(notificationRecipient -> {
assertTrue(Arrays.asList(userIds).contains(notificationRecipient.getRecipient().getUserId()));
assertEquals(notification, notificationRecipient.getNotification());
verify(cachedNotificationService).resetUnreadCount(notificationRecipient.getRecipient().getUserId());
verify(firebaseNotificationSender).sendFirebaseNotification(notificationRecipient);
});
}
use of amu.zhcet.notification.Notification in project zhcet-web by zhcet-amu.
the class NotificationSendingServiceTest method saveNotificationPrimary.
@Test
public void saveNotificationPrimary() {
Notification notification = getNotification();
notificationSendingService.sendNotification(notification);
assertNotNull(notification.getSentTime());
verify(cachedNotificationService).save(notification);
}
Aggregations