feat(expense): add Form990ExpenseLine catalog entity and functional-class constants
This commit is contained in:
@@ -20,6 +20,7 @@ public class AppDbContext : IdentityDbContext<AppUser, AppRole, string>
|
||||
public DbSet<Ministry> Ministries => Set<Ministry>();
|
||||
public DbSet<ExpenseCategoryGroup> ExpenseCategoryGroups => Set<ExpenseCategoryGroup>();
|
||||
public DbSet<ExpenseSubCategory> ExpenseSubCategories => Set<ExpenseSubCategory>();
|
||||
public DbSet<Form990ExpenseLine> Form990ExpenseLines => Set<Form990ExpenseLine>();
|
||||
public DbSet<Expense> Expenses => Set<Expense>();
|
||||
public DbSet<MonthlyStatement> MonthlyStatements => Set<MonthlyStatement>();
|
||||
public DbSet<ChurchProfile> ChurchProfiles => Set<ChurchProfile>();
|
||||
@@ -202,6 +203,17 @@ public class AppDbContext : IdentityDbContext<AppUser, AppRole, string>
|
||||
entity.Property(e => e.Name_zh).HasMaxLength(200);
|
||||
});
|
||||
|
||||
// ── Form990ExpenseLine (Part IX natural-expense line catalog) ─────────
|
||||
builder.Entity<Form990ExpenseLine>(entity =>
|
||||
{
|
||||
entity.Property(e => e.LineCode).HasMaxLength(10).IsRequired();
|
||||
entity.Property(e => e.Name_en).HasMaxLength(200).IsRequired();
|
||||
entity.Property(e => e.Name_zh).HasMaxLength(200);
|
||||
entity.Property(e => e.CreatedBy).HasMaxLength(450);
|
||||
entity.Property(e => e.UpdatedBy).HasMaxLength(450);
|
||||
entity.HasIndex(e => e.LineCode).IsUnique();
|
||||
});
|
||||
|
||||
// ── ExpenseCategoryGroup ─────────────────────────────────────────────
|
||||
builder.Entity<ExpenseCategoryGroup>(entity =>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using ROLAC.API.Entities.Base;
|
||||
namespace ROLAC.API.Entities;
|
||||
|
||||
/// <summary>A row of IRS Form 990 Part IX (natural expense line), e.g. "7 — Other salaries and wages".</summary>
|
||||
public class Form990ExpenseLine : AuditableEntity, IAuditable
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string LineCode { get; set; } = null!; // "7", "11b", "16", "24"
|
||||
public string Name_en { get; set; } = null!;
|
||||
public string? Name_zh { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace ROLAC.API.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// The three IRS Form 990 Part IX functional-expense columns. Stored verbatim in
|
||||
/// Ministry.DefaultFunctionalClass and Expense.FunctionalClass.
|
||||
/// </summary>
|
||||
public static class FunctionalClasses
|
||||
{
|
||||
public const string Program = "Program";
|
||||
public const string ManagementGeneral = "ManagementGeneral";
|
||||
public const string Fundraising = "Fundraising";
|
||||
|
||||
public static readonly IReadOnlyList<string> All = [Program, ManagementGeneral, Fundraising];
|
||||
|
||||
/// <summary>Returns the value if valid, otherwise Program (the safe default).</summary>
|
||||
public static string Normalize(string? value) =>
|
||||
value is not null && All.Contains(value) ? value : Program;
|
||||
}
|
||||
Reference in New Issue
Block a user