mirror of
https://github.com/Shchoholiev/shopping-assistant-api.git
synced 2025-04-05 00:59:36 +00:00
18 lines
668 B
C#
18 lines
668 B
C#
using System.Linq.Expressions;
|
|
using MongoDB.Driver;
|
|
using ShoppingAssistantApi.Application.IRepositories;
|
|
using ShoppingAssistantApi.Domain.Entities;
|
|
using ShoppingAssistantApi.Persistance.Database;
|
|
|
|
namespace ShoppingAssistantApi.Persistance.Repositories;
|
|
|
|
public class WishlistsRepository : BaseRepository<Wishlist>, IWishlistsRepository
|
|
{
|
|
public WishlistsRepository(MongoDbContext db) : base(db, "Wishlists") { }
|
|
|
|
public async Task<Wishlist> GetWishlistAsync(Expression<Func<Wishlist, bool>> predicate, CancellationToken cancellationToken)
|
|
{
|
|
return await (await _collection.FindAsync(predicate)).FirstOrDefaultAsync(cancellationToken);
|
|
}
|
|
}
|