diff --git a/Domus.Domain/Dtos/DtoNotification.cs b/Domus.Domain/Dtos/DtoNotification.cs index 557a75f..ab932ae 100644 --- a/Domus.Domain/Dtos/DtoNotification.cs +++ b/Domus.Domain/Dtos/DtoNotification.cs @@ -9,5 +9,5 @@ public class DtoNotification public DateTime SentAt { get; set; } public NotificationStatus Status { get; set; } public string? RedirectString { get; set; } - public string Image { get; set; } + public string? Image { get; set; } } \ No newline at end of file diff --git a/Domus.Domain/Entities/Notification.cs b/Domus.Domain/Entities/Notification.cs index 2f76605..39d3268 100644 --- a/Domus.Domain/Entities/Notification.cs +++ b/Domus.Domain/Entities/Notification.cs @@ -11,6 +11,6 @@ public class Notification : BaseEntity public NotificationStatus Status { get; set; } public string? RedirectString { get; set; } - public string Image { get; set; } + public string? Image { get; set; } public DomusUser Recipient { get; set; } } \ No newline at end of file diff --git a/Domus.Service/Implementations/NotificationService.cs b/Domus.Service/Implementations/NotificationService.cs index c67ea5c..89f7ea2 100644 --- a/Domus.Service/Implementations/NotificationService.cs +++ b/Domus.Service/Implementations/NotificationService.cs @@ -111,8 +111,10 @@ public async Task GetPaginatedNotifications(BasePaginatedRe if (!isValidToken) throw new InvalidTokenException(); var userId = _jwtService.GetTokenClaim(token, TokenClaimConstants.SUBJECT)?.ToString() ?? throw new UserNotFoundException(); - var notifications = await (await _notificationRepository.FindAsync(x => x.RecipientId.Equals(userId))) + var notifications = await (await _notificationRepository + .FindAsync(x => x.RecipientId.Equals(userId))) .ProjectTo(_mapper.ConfigurationProvider) + .OrderByDescending(x => x.SentAt) .ToListAsync(); var paginatedList = PaginationHelper.BuildPaginatedResult(notifications.AsQueryable(), request.PageSize, request.PageIndex); return new ServiceActionResult()