Show latest credit ledger in admin

Expose a paginated global ledger timeline and load it automatically so operators can see recent credit activity without first locating a user.
This commit is contained in:
Rocky
2026-08-19 18:05:54 +08:00
parent 58445dd880
commit 75c046d91d
15 changed files with 356 additions and 34 deletions
+21 -1
View File
@@ -604,6 +604,25 @@ paths:
"400": { description: Cursor is malformed }
"403": { description: ANALYST role cannot access credit ledger records }
"404": { description: User was not found }
/v1/admin/credits/ledger:
get:
security:
- adminMtls: []
adminSession: []
summary: Return the latest immutable credit ledger entries across users
parameters:
- name: cursor
in: query
schema: { type: string, maxLength: 256 }
- $ref: "#/components/parameters/Limit"
responses:
"200":
description: Latest credit ledger entries ordered by creation time and entry ID
content:
application/json:
schema: { $ref: "#/components/schemas/AdminLedgerPage" }
"400": { description: Cursor is malformed }
"403": { description: ANALYST role cannot access credit ledger records }
/v1/admin/credits/grants:
post:
security:
@@ -1015,9 +1034,10 @@ components:
AdminLedgerEntry:
type: object
additionalProperties: false
required: [entryId, type, amount, balanceAfter, reasonCode, createdAt]
required: [entryId, userId, type, amount, balanceAfter, reasonCode, createdAt]
properties:
entryId: { type: string, format: uuid }
userId: { type: string, format: uuid }
type: { type: string, enum: [grant, reserve, settle, refund, adjustment] }
amount: { type: integer, format: int64 }
balanceAfter: { type: integer, format: int64, minimum: 0 }