Ejemplo n.º 1
0
        public async Task <IEnumerable <NotificationList> > Handle(GetCurrentUserNotificationsQuery request, CancellationToken cancellationToken)
        {
            string userId = _authService.GetCurrentUserId();

            return(await _context
                   .Set <Notification>()
                   .Where(n => n.UserId == userId)
                   .Where(n => !n.ReadAt.HasValue)
                   .OrderByDescending(c => c.CreatedAt)
                   .ProjectTo <NotificationList>(_mapper.ConfigurationProvider)
                   .ToArrayAsync(cancellationToken));
        }
Ejemplo n.º 2
0
 public Task <IEnumerable <NotificationList> > Get([FromQuery] GetCurrentUserNotificationsQuery query)
 {
     return(Mediator.Send(query));
 }