feat(1099): carry PayeeId through expense create/update/read

Add int? PayeeId to CreateExpenseRequest (UpdateExpenseRequest inherits)
and to ExpenseListItemDto (so it round-trips to the form). Set e.PayeeId
unconditionally in CreateAsync and UpdateAsync so 1099 attribution is
independent of VendorPayment vs StaffReimbursement type. Map PayeeId in
both DTO projections: the paged-list lambda and GetByIdAsync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Chris Chen
2026-06-25 17:08:01 -07:00
parent 7c5348969b
commit 7c63f6c9ba
2 changed files with 6 additions and 1 deletions
@@ -35,6 +35,7 @@ public class ExpenseListItemDto
public string? ReviewedByName { get; set; } // resolved Member full name, email fallback
public DateTimeOffset? ReviewedAt { get; set; }
public string? ReviewNotes { get; set; } // reject reason (or approval note)
public int? PayeeId { get; set; }
}
public class ExpenseDto : ExpenseListItemDto
@@ -66,6 +67,7 @@ public class CreateExpenseRequest
[MaxLength(50)] public string? CheckNumber { get; set; }
[Required] public DateOnly ExpenseDate { get; set; }
public string? Notes { get; set; }
public int? PayeeId { get; set; }
}
public class UpdateExpenseRequest : CreateExpenseRequest { }
+4 -1
View File
@@ -120,6 +120,7 @@ public class ExpenseService : IExpenseService
ReviewedByName = e.ReviewedBy != null ? reviewerNames.GetValueOrDefault(e.ReviewedBy) : null,
ReviewedAt = e.ReviewedAt,
ReviewNotes = e.ReviewNotes,
PayeeId = e.PayeeId,
};
}).ToList();
@@ -211,6 +212,7 @@ public class ExpenseService : IExpenseService
CheckNumber = e.CheckNumber, Notes = e.Notes, ReviewNotes = e.ReviewNotes,
ReviewedByName = reviewerName, ReviewedAt = e.ReviewedAt,
SubmittedBy = e.SubmittedBy, SubmittedAt = e.SubmittedAt, PaidAt = e.PaidAt,
PayeeId = e.PayeeId,
Lines = lineDtos,
};
}
@@ -273,6 +275,7 @@ public class ExpenseService : IExpenseService
e.VendorName = null;
}
e.PayeeId = r.PayeeId;
_db.Expenses.Add(e);
await _db.SaveChangesAsync();
return e.Id;
@@ -294,7 +297,7 @@ public class ExpenseService : IExpenseService
throw new InvalidOperationException("You can only edit your own draft, pending, or rejected reimbursements.");
e.MinistryId = r.MinistryId; e.Description = r.Description; e.CheckNumber = r.CheckNumber;
e.ExpenseDate = r.ExpenseDate; e.Notes = r.Notes;
e.ExpenseDate = r.ExpenseDate; e.Notes = r.Notes; e.PayeeId = r.PayeeId;
if (e.Type == "VendorPayment") e.VendorName = r.VendorName;
// Replace the line set wholesale (lines are owned by the header), recompute the total.