using Blueprint.Core.Entities; using Blueprint.Core.Errors; using Blueprint.Infra.Database; using Blueprint.Infra.Services; using Microsoft.EntityFrameworkCore; using MongoDB.Driver; using Template.Core.Interfaces.SPI; namespace Template.Infra.Services { public class MongoUserInfra : MongoItemInfra, IUserInfra { public MongoUserInfra(IMongoDatabase dbContext, ILogger logger) : base(dbContext, logger) { } public async Task GetUserByEmail(string email) { try { return await _dbSet.Find(p => p.Email == email).FirstOrDefaultAsync(); } catch (Exception) { _logger.LogError($"Cannot get a user"); throw Errors.CannotQueryError; } } } }