Distribution_GL Initialization

This commit is contained in:
2026-10-20 13:07:07 +05:30
commit 3f16e0cb44
194 changed files with 35659 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
using General_Ledger_Service.Infra;
using General_Ledger_Service.Interfaces.Repositories;
using General_Ledger_Service.Models;
using Microsoft.EntityFrameworkCore;
namespace General_Ledger_Service.Repositories
{
public class FiscalCalendarRepository(AppDBContext context) : IFiscalCalendarRepository
{
private readonly AppDBContext _context = context;
public Task<FiscalYear?> GetFiscalYearByIdAsync(int fiscalYearId) =>
RepositoryHelpers.GetByIdAsync(_context.FiscalYears, fiscalYearId);
public Task<bool> HasOverlappingFiscalYearRangeAsync(DateOnly startDate, DateOnly endDate) =>
RepositoryHelpers.ExistsAsync(_context.FiscalYears, fy => startDate <= fy.EndDate && endDate >= fy.StartDate);
public Task<FiscalYear> AddFiscalYearAsync(FiscalYear fiscalYear) =>
RepositoryHelpers.AddAsync(_context.FiscalYears, fiscalYear);
public Task<AccountingPeriod?> GetPeriodByIdAsync(int periodId) =>
RepositoryHelpers.GetByIdAsync(_context.AccountingPeriods, periodId);
public async Task<AccountingPeriod?> GetPeriodByDateAsync(DateOnly date) =>
await _context.AccountingPeriods
.FirstOrDefaultAsync(p => p.StartDate <= date && p.EndDate >= date);
public async Task<List<AccountingPeriod>> GetPeriodsByFiscalYearIdAsync(int fiscalYearId) =>
await _context.AccountingPeriods
.Where(p => p.FiscalYearId == fiscalYearId)
.OrderBy(p => p.PeriodNumber)
.ToListAsync();
public async Task AddPeriodRangeAsync(IEnumerable<AccountingPeriod> periods) =>
await _context.AccountingPeriods.AddRangeAsync(periods);
public Task<PeriodLockLog> AddPeriodLockLogAsync(PeriodLockLog log) =>
RepositoryHelpers.AddAsync(_context.PeriodLockLogs, log);
}
}