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)); }
public Task <IEnumerable <NotificationList> > Get([FromQuery] GetCurrentUserNotificationsQuery query) { return(Mediator.Send(query)); }