Raghava Pulugu
Deploy app without exposed API tokens
7535af1
Raw
History Blame Contribute Delete
681 Bytes
using System.Collections.Generic;
using System.Threading.Tasks;
using MongoDB.Driver;
using TelegramSaaS.Application.Common.Interfaces.Persistence;
using TelegramSaaS.Domain.Entities;
namespace TelegramSaaS.Infrastructure.Persistence.Repositories;
public class CreditLedgerRepository : MongoRepository<CreditLedger>, ICreditLedgerRepository
{
public CreditLedgerRepository(MongoDbContext context) : base(context, "CreditLedger")
{
}
public async Task<IEnumerable<CreditLedger>> GetByUserIdAsync(string userId)
{
return await Collection.Find(x => x.UserId == userId)
.SortByDescending(x => x.CreatedAt)
.ToListAsync();
}
}