md-platform

admin-vouchers-changes.md
View raw Back to list

Admin Vouchers API — Changes

Two updates to the admin vouchers list endpoint (GET /admin/v1/vouchers).

1. Redeemed-by user info

Each voucher in the response now includes a redeemedBy object identifying the user who redeemed it, resolved from the auth database:

{
  "voucherId": "...",
  "code": "ABCD-1234",
  "status": "Redeemed",
  "redeemedByUserId": "auth0|123",
  "redeemedBy": {
    "id": "auth0|123",
    "fullName": "Filan Fisteku",
    "email": "[email protected]"
  },
  "redeemedAt": "2026-07-01T10:15:00Z"
}

Files changed

File Change
core/PicTv.Application/Dtos/Vouchers/VoucherDto.cs Added RedeemedBy property and new VoucherRedeemedByDto (Id, FullName, Email)
core/PicTv.Application/Vouchers/Queries/GetAdminVouchers/GetAdminVouchersQueryHandler.cs Injected IAuthDbContext; added PopulateRedeemedByAsync to enrich results with user name and email

2. Order by reason

New optional query parameter orderByReason (boolean, default false):

GET /admin/v1/vouchers?page=1&orderByReason=true

Files changed

File Change
api/PicTv.Api/Routes/VoucherRoutes.cs Added orderByReason query parameter to the admin list endpoint
core/PicTv.Application/Vouchers/Queries/GetAdminVouchers/GetAdminVouchersQuery.cs Added OrderByReason property (defaults to false)
core/PicTv.Application/Vouchers/Queries/GetAdminVouchers/GetAdminVouchersQueryHandler.cs Applies OrderBy(Reason).ThenByDescending(CreatedAt) when the flag is set

Notes