use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.
the class NotificationRestController method deleteByIds.
@DeleteMapping
public void deleteByIds(@RequestParam(name = "ids") final String notificationIdsListStr) {
userSession.assertLoggedIn();
final UserId adUserId = userSession.getLoggedUserId();
final List<String> notificationIds = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(notificationIdsListStr);
if (notificationIds.isEmpty()) {
throw new AdempiereException("No IDs provided");
}
notificationIds.forEach(notificationId -> userNotificationsService.deleteNotification(adUserId, notificationId));
}
use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.
the class NotificationRestController method getNotifications.
@GetMapping("/all")
public JSONNotificationsList getNotifications(//
@RequestParam(name = "limit", defaultValue = "-1") final int limit) {
userSession.assertLoggedIn();
final UserId adUserId = userSession.getLoggedUserId();
final UserNotificationsList notifications = userNotificationsService.getNotifications(adUserId, limit);
final JSONOptions jsonOpts = JSONOptions.of(userSession);
return JSONNotificationsList.of(notifications, jsonOpts);
}
use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.
the class NotificationRestController method markAllAsRead.
@PutMapping("/all/read")
public void markAllAsRead() {
userSession.assertLoggedIn();
final UserId adUserId = userSession.getLoggedUserId();
userNotificationsService.markAllNotificationsAsRead(adUserId);
}
use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.
the class NotificationRestController method deleteById.
@DeleteMapping("/{notificationId}")
public void deleteById(@PathVariable("notificationId") final String notificationId) {
userSession.assertLoggedIn();
final UserId adUserId = userSession.getLoggedUserId();
userNotificationsService.deleteNotification(adUserId, notificationId);
}
use of de.metas.user.UserId in project metasfresh-webui-api by metasfresh.
the class NotificationRestController method deleteAll.
@DeleteMapping("/all")
public void deleteAll() {
userSession.assertLoggedIn();
final UserId adUserId = userSession.getLoggedUserId();
userNotificationsService.deleteAllNotification(adUserId);
}
Aggregations