Skip to content

Commit e6e63f5

Browse files
authored
Sort notifications by newest (#1074)
Gets rid of the EF warning when requesting notifications.
2 parents 8a1b1f1 + 38e5a95 commit e6e63f5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Refresh.Database/GameDatabaseContext.Notifications.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ public int GetNotificationCountByUser(GameUser user) =>
5757
.Count(n => n.User == user);
5858

5959
[Pure]
60-
public DatabaseList<GameNotification> GetNotificationsByUser(GameUser user, int count, int skip) =>
61-
new(this.GameNotifications.Where(n => n.User == user), skip, count);
60+
public DatabaseList<GameNotification> GetNotificationsByUser(GameUser user, int count, int skip)
61+
=> new(this.GameNotifications
62+
.Where(n => n.UserId == user.UserId)
63+
.OrderByDescending(n => n.CreatedAt), skip, count);
6264

6365
[Pure]
6466
public GameNotification? GetNotificationByUuid(GameUser user, ObjectId id)

0 commit comments

Comments
 (0)