feat: item to collection
This commit is contained in:
@@ -25,10 +25,15 @@ public sealed class CollectionRepository : ICollectionRepository
|
||||
return await _db.Collections
|
||||
.Include(c => c.Members)
|
||||
.Where(x => x.OwnerTelegramId == ownerTelegramId)
|
||||
.OrderBy(x => x.Name)
|
||||
.OrderBy(x => x.IsInbox ? 0 : 1) // Inbox всегда первым
|
||||
.ThenBy(x => x.Name)
|
||||
.ToListAsync(ct);
|
||||
}
|
||||
|
||||
public Task<Collection?> GetInboxAsync(long ownerTelegramId, CancellationToken ct) =>
|
||||
_db.Collections
|
||||
.FirstOrDefaultAsync(x => x.OwnerTelegramId == ownerTelegramId && x.IsInbox, ct);
|
||||
|
||||
public async Task AddAsync(Collection collection, CancellationToken ct) =>
|
||||
await _db.Collections.AddAsync(collection, ct);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user