Add CollectedByUserId to payment DTOs as auth workaround

This commit is contained in:
2026-09-03 17:20:12 +05:30
parent ad74074771
commit c962ed9425
3 changed files with 15 additions and 4 deletions
@@ -44,7 +44,10 @@ public class PaymentService(
if (sale.Status == SaleStatus.Cancelled)
throw new InvalidOperationException("Cannot record a payment against a cancelled sale");
var userId = currentUser.UserId ?? throw new UnauthorizedAccessException();
// TEMPORARY: currentUser.UserId is always unset due to the broken auth middleware
// (testbug.md #28) — fall back to the explicitly supplied user until that's fixed.
var userId = currentUser.UserId ?? request.CollectedByUserId
?? throw new InvalidOperationException("CollectedByUserId is required while auth is unavailable");
var payment = new Models.Payment
{