Phase 1: Introduce typed repository interfaces and report service stubs
Six IUnitOfWork properties upgraded from generic IRepository<T> to domain-specific typed interfaces (IJobRepository, IQuoteRepository, IInvoiceRepository, ICustomerRepository, IBillRepository, IPurchaseOrderRepository). Each backed by a concrete typed repository that encapsulates complex include chains previously inlined in controllers. Also adds IFinancialReportService and IOperationalReportService stub implementations (NotImplementedException placeholders) to Application.Interfaces and Infrastructure.Services, registered in Program.cs. These are the migration targets for ReportsController's aggregate query methods in Phase 2. No controller behaviour changed in this commit — all callers still compile because typed interfaces extend IRepository<T>. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using PowderCoating.Application.DTOs.Accounting;
|
||||
|
||||
namespace PowderCoating.Application.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Read-only service for financial aggregate reports. All methods query the database
|
||||
/// with AsNoTracking and return pre-shaped DTOs — no tracked entities are returned.
|
||||
/// Implemented in Infrastructure; uses ApplicationDbContext directly.
|
||||
/// </summary>
|
||||
public interface IFinancialReportService
|
||||
{
|
||||
/// <summary>Returns a Profit & Loss report for the given company and date range.</summary>
|
||||
Task<ProfitAndLossDto> GetProfitAndLossAsync(int companyId, DateTime from, DateTime to);
|
||||
|
||||
/// <summary>Returns a Balance Sheet snapshot as of the given date.</summary>
|
||||
Task<BalanceSheetDto> GetBalanceSheetAsync(int companyId, DateTime asOf);
|
||||
|
||||
/// <summary>Returns an AR Aging report bucketed at 0-30, 31-60, 61-90, and 90+ days.</summary>
|
||||
Task<ArAgingReportDto> GetArAgingAsync(int companyId, DateTime asOf);
|
||||
|
||||
/// <summary>Returns a Sales & Income report for the given company and date range.</summary>
|
||||
Task<SalesIncomeReportDto> GetSalesAndIncomeAsync(int companyId, DateTime from, DateTime to);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace PowderCoating.Application.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Placeholder return types for operational reports. These will be replaced with proper
|
||||
/// Application DTOs as each report is migrated from ReportsController in Phase 2/3.
|
||||
/// </summary>
|
||||
public record JobCycleTimeReport(List<JobCycleTimeRow> Rows, int Months);
|
||||
public record JobCycleTimeRow(string StatusName, double AvgDaysInStatus, int JobCount);
|
||||
|
||||
public record PowderUsageReport(List<PowderUsageRow> Rows, int Months);
|
||||
public record PowderUsageRow(string ColorName, string VendorName, decimal TotalLbs, decimal TotalCost);
|
||||
|
||||
/// <summary>
|
||||
/// Read-only service for operational aggregate reports. All methods query the database
|
||||
/// with AsNoTracking and return pre-shaped objects — no tracked entities are returned.
|
||||
/// Implemented in Infrastructure; uses ApplicationDbContext directly.
|
||||
/// </summary>
|
||||
public interface IOperationalReportService
|
||||
{
|
||||
/// <summary>Returns average time jobs spend in each status over the given lookback period.</summary>
|
||||
Task<JobCycleTimeReport> GetJobCycleTimeAsync(int companyId, int months);
|
||||
|
||||
/// <summary>Returns powder usage (lbs and cost) broken down by color and vendor.</summary>
|
||||
Task<PowderUsageReport> GetPowderUsageAsync(int companyId, int months);
|
||||
}
|
||||
Reference in New Issue
Block a user