diff --git a/API/ROLAC.API/Controllers/Form990ReportController.cs b/API/ROLAC.API/Controllers/Form990ReportController.cs index f38fb69..b56c08c 100644 --- a/API/ROLAC.API/Controllers/Form990ReportController.cs +++ b/API/ROLAC.API/Controllers/Form990ReportController.cs @@ -12,6 +12,9 @@ public class Form990ReportController : ControllerBase private readonly IForm990ReportService _svc; public Form990ReportController(IForm990ReportService svc) => _svc = svc; + [HttpGet("lines")] + public async Task Lines() => Ok(await _svc.GetLinesAsync()); + [HttpGet("functional-expenses")] public async Task FunctionalExpenses([FromQuery] DateOnly? from, [FromQuery] DateOnly? to) => Ok(await _svc.GetFunctionalExpenseStatementAsync(from, to)); diff --git a/API/ROLAC.API/DTOs/Finance/Form990ReportDtos.cs b/API/ROLAC.API/DTOs/Finance/Form990ReportDtos.cs index 1d0d33c..a012371 100644 --- a/API/ROLAC.API/DTOs/Finance/Form990ReportDtos.cs +++ b/API/ROLAC.API/DTOs/Finance/Form990ReportDtos.cs @@ -23,3 +23,13 @@ public class FunctionalExpenseStatementDto /// Expenses with no explicit 990 mapping (counted under line 24). Prompts mapping cleanup. public int UnmappedExpenseCount { get; set; } } + +/// A single IRS Form 990 expense line from the catalog (used to populate mapping dropdowns). +public class Form990ExpenseLineDto +{ + public int Id { get; set; } + public string LineCode { get; set; } = ""; + public string Name_en { get; set; } = ""; + public string? Name_zh { get; set; } + public int SortOrder { get; set; } +} diff --git a/API/ROLAC.API/Services/Form990ReportService.cs b/API/ROLAC.API/Services/Form990ReportService.cs index 845fbb2..d43e7eb 100644 --- a/API/ROLAC.API/Services/Form990ReportService.cs +++ b/API/ROLAC.API/Services/Form990ReportService.cs @@ -15,6 +15,19 @@ public class Form990ReportService : IForm990ReportService private readonly AppDbContext _db; public Form990ReportService(AppDbContext db) => _db = db; + public async Task> GetLinesAsync() => + await _db.Form990ExpenseLines.AsNoTracking().Where(l => l.IsActive) + .OrderBy(l => l.SortOrder) + .Select(l => new Form990ExpenseLineDto + { + Id = l.Id, + LineCode = l.LineCode, + Name_en = l.Name_en, + Name_zh = l.Name_zh, + SortOrder = l.SortOrder, + }) + .ToListAsync(); + public async Task GetFunctionalExpenseStatementAsync(DateOnly? from, DateOnly? to) { var lines = await _db.Form990ExpenseLines.AsNoTracking() diff --git a/API/ROLAC.API/Services/IForm990ReportService.cs b/API/ROLAC.API/Services/IForm990ReportService.cs index bc7961b..3509848 100644 --- a/API/ROLAC.API/Services/IForm990ReportService.cs +++ b/API/ROLAC.API/Services/IForm990ReportService.cs @@ -4,4 +4,5 @@ namespace ROLAC.API.Services; public interface IForm990ReportService { Task GetFunctionalExpenseStatementAsync(DateOnly? from, DateOnly? to); + Task> GetLinesAsync(); }