Raghava Pulugu
Deploy app without exposed API tokens
7535af1
Raw
History Blame Contribute Delete
732 Bytes
using System.Threading.Tasks;
using MongoDB.Driver;
using TelegramSaaS.Application.Common.Interfaces.Persistence;
using TelegramSaaS.Domain.Entities;
namespace TelegramSaaS.Infrastructure.Persistence.Repositories;
public class UserRepository : MongoRepository<User>, IUserRepository
{
public UserRepository(MongoDbContext context) : base(context, "Users")
{
}
public async Task<User?> GetByTelegramChatIdAsync(long chatId)
{
return await Collection.Find(x => x.TelegramChatId == chatId).FirstOrDefaultAsync();
}
public async Task<User?> GetByReferralCodeAsync(string referralCode)
{
return await Collection.Find(x => x.ReferralCode == referralCode).FirstOrDefaultAsync();
}
}