Skip to content

Commit 38e5a95

Browse files
committed
Sort notifications by newest
1 parent dbba2fb commit 38e5a95

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)