mirror of
https://github.com/Shchoholiev/shopping-assistant-api.git
synced 2025-04-04 16:49:36 +00:00
fix: return oredered wishlist messages
Before that there was a possibility of returning pages with incorrectly ordered messages
This commit is contained in:
parent
b9a58a963a
commit
1412c07fa2
@ -218,7 +218,7 @@ public class DbInitialaizer
|
||||
Text = "Message 2",
|
||||
Role = MessageRoles.Application.ToString(),
|
||||
WishlistId = wishlistId1,
|
||||
CreatedDateUtc = DateTime.UtcNow
|
||||
CreatedDateUtc = DateTime.UtcNow.AddSeconds(5)
|
||||
},
|
||||
new Message
|
||||
{
|
||||
@ -226,14 +226,14 @@ public class DbInitialaizer
|
||||
Role = MessageRoles.User.ToString(),
|
||||
WishlistId = wishlistId1,
|
||||
CreatedById = user1.Id,
|
||||
CreatedDateUtc = DateTime.UtcNow
|
||||
CreatedDateUtc = DateTime.UtcNow.AddSeconds(20)
|
||||
},
|
||||
new Message
|
||||
{
|
||||
Text = "Message 4",
|
||||
Role = MessageRoles.Application.ToString(),
|
||||
WishlistId = wishlistId1,
|
||||
CreatedDateUtc = DateTime.UtcNow
|
||||
CreatedDateUtc = DateTime.UtcNow.AddSeconds(25)
|
||||
},
|
||||
new Message
|
||||
{
|
||||
@ -241,14 +241,14 @@ public class DbInitialaizer
|
||||
Role = MessageRoles.User.ToString(),
|
||||
WishlistId = wishlistId1,
|
||||
CreatedById = user1.Id,
|
||||
CreatedDateUtc = DateTime.UtcNow
|
||||
CreatedDateUtc = DateTime.UtcNow.AddSeconds(45)
|
||||
},
|
||||
new Message
|
||||
{
|
||||
Text = "Message 6",
|
||||
Role = MessageRoles.Application.ToString(),
|
||||
WishlistId = wishlistId1,
|
||||
CreatedDateUtc = DateTime.UtcNow
|
||||
CreatedDateUtc = DateTime.UtcNow.AddSeconds(50)
|
||||
},
|
||||
new Message
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ public class MessagesRepository : BaseRepository<Message>, IMessagesRepository
|
||||
}
|
||||
|
||||
return await _collection.Find(predicate)
|
||||
.SortBy(x => x.CreatedDateUtc)
|
||||
.Skip((numberOfPages - pageNumber) * pageSize)
|
||||
.Limit(pageSize)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
Loading…
Reference in New Issue
Block a user