first commit

This commit is contained in:
Dhananjaya99
2026-09-28 11:44:26 +05:30
parent 721743ae6b
commit bffc9b1686
424 changed files with 46474 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
using Fitness_core_BE.Interfaces;
using Fitness_core_BE.Models;
using Fitness_core_BE.Models.Enums;
using Microsoft.EntityFrameworkCore;
namespace Fitness_core_BE.Repos
{
public class PaymentsEnablementRepository : IPaymentsEnablementRepository
{
private readonly CentralDbContext _context;
public PaymentsEnablementRepository(CentralDbContext context)
{
_context = context;
}
public async Task<ClientWallet?> GetWalletByClientIdAsync(Guid clientId, CancellationToken ct = default)
{
return await _context.ClientWallets
.FirstOrDefaultAsync(w => w.FKClientId == clientId, ct);
}
public async Task<List<WalletLedgerEntry>> GetLedgerAsync(Guid walletId, CancellationToken ct = default)
{
return await _context.WalletLedgerEntries
.AsNoTracking()
.Where(e => e.FKWalletId == walletId)
.OrderByDescending(e => e.CreatedAt)
.ToListAsync(ct);
}
public async Task<ClientPayoutKyc?> GetKycByClientIdAsync(Guid clientId, CancellationToken ct = default)
{
return await _context.ClientPayoutKycs
.AsNoTracking()
.Include(k => k.Client)
.Where(k => k.FKClientId == clientId)
.OrderByDescending(k => k.SubmittedAt)
.FirstOrDefaultAsync(ct);
}
public async Task<ClientPayoutKyc?> GetKycForUpdateAsync(
Guid clientId,
CancellationToken ct = default)
{
return await _context.ClientPayoutKycs
.Include(k => k.Client)
.Where(k => k.FKClientId == clientId)
.OrderByDescending(k => k.SubmittedAt)
.FirstOrDefaultAsync(ct);
}
public async Task CreateKycAsync(ClientPayoutKyc kyc, CancellationToken ct = default)
{
await _context.ClientPayoutKycs.AddAsync(kyc, ct);
}
public async Task<(List<ClientPayoutKyc> Items, int Total)> ListKycAsync(string? status, CancellationToken ct = default)
{
var query = _context.ClientPayoutKycs
.AsNoTracking()
.Include(k => k.Client)
.AsQueryable();
if (!string.IsNullOrWhiteSpace(status) && Enum.TryParse<KycStatus>(status, true, out var parsedStatus))
query = query.Where(k => k.KycStatus == parsedStatus);
var total = await query.CountAsync(ct);
var items = await query.OrderByDescending(k => k.SubmittedAt).ToListAsync(ct);
return (items, total);
}
public async Task CreateWalletAsync(ClientWallet wallet, CancellationToken ct = default)
{
await _context.ClientWallets.AddAsync(wallet, ct);
}
public async Task CreateClientCardAsync(ClientCard card, CancellationToken ct = default)
{
await _context.ClientCard.AddAsync(card, ct);
}
}
}