Spaces:
Sleeping
Sleeping
SaluAi / src /Infrastructure /TelegramSaaS.Infrastructure /Persistence /Repositories /CreditLedgerRepository.cs
| 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(); | |
| } | |
| } | |