Add admin dashboard filtering and sorting
Provide stable server-side list queries and focused chart controls so operators can inspect large datasets without misleading partial-page ordering.
This commit is contained in:
+102
-9
@@ -593,13 +593,20 @@ paths:
|
||||
summary: Return referral funnel and ranking statistics
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/AdminRange"
|
||||
- name: sort
|
||||
in: query
|
||||
schema: { type: string, enum: [invited, qualified, creditsEarned] }
|
||||
- $ref: "#/components/parameters/AdminSortOrder"
|
||||
- name: limit
|
||||
in: query
|
||||
schema: { type: integer, minimum: 1, maximum: 100, default: 20 }
|
||||
responses:
|
||||
"200":
|
||||
description: Referral statistics
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/AdminReferralOverview" }
|
||||
"400": { description: Range is invalid }
|
||||
"400": { description: Range, sort, order, or limit is invalid }
|
||||
"401": { description: Session is invalid }
|
||||
/v1/admin/analytics:
|
||||
get:
|
||||
@@ -631,13 +638,20 @@ paths:
|
||||
in: query
|
||||
schema: { type: string, maxLength: 256 }
|
||||
- $ref: "#/components/parameters/Limit"
|
||||
- $ref: "#/components/parameters/AdminFrom"
|
||||
- $ref: "#/components/parameters/AdminUntil"
|
||||
- name: status
|
||||
in: query
|
||||
schema: { type: string, enum: [active, suspended] }
|
||||
- $ref: "#/components/parameters/AdminCreatedAtSort"
|
||||
- $ref: "#/components/parameters/AdminSortOrder"
|
||||
responses:
|
||||
"200":
|
||||
description: Privacy-minimized user summaries
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/AdminUserPage" }
|
||||
"400": { description: Query or cursor is malformed }
|
||||
"400": { description: Query, filter, sort, limit, or cursor is malformed }
|
||||
"401": { description: Session is invalid }
|
||||
"403": { description: ANALYST role cannot access user records }
|
||||
/v1/admin/users/{userId}:
|
||||
@@ -667,14 +681,19 @@ paths:
|
||||
- name: cursor
|
||||
in: query
|
||||
schema: { type: string, maxLength: 256 }
|
||||
- $ref: "#/components/parameters/Limit"
|
||||
- $ref: "#/components/parameters/AdminLedgerLimit"
|
||||
- $ref: "#/components/parameters/AdminFrom"
|
||||
- $ref: "#/components/parameters/AdminUntil"
|
||||
- $ref: "#/components/parameters/AdminLedgerType"
|
||||
- $ref: "#/components/parameters/AdminCreatedAtSort"
|
||||
- $ref: "#/components/parameters/AdminSortOrder"
|
||||
responses:
|
||||
"200":
|
||||
description: Credit ledger entries ordered by creation time and entry ID
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/AdminLedgerPage" }
|
||||
"400": { description: Cursor is malformed }
|
||||
"400": { description: Filter, sort, limit, or cursor is malformed }
|
||||
"403": { description: ANALYST role cannot access credit ledger records }
|
||||
"404": { description: User was not found }
|
||||
/v1/admin/credits/ledger:
|
||||
@@ -687,14 +706,19 @@ paths:
|
||||
- name: cursor
|
||||
in: query
|
||||
schema: { type: string, maxLength: 256 }
|
||||
- $ref: "#/components/parameters/Limit"
|
||||
- $ref: "#/components/parameters/AdminLedgerLimit"
|
||||
- $ref: "#/components/parameters/AdminFrom"
|
||||
- $ref: "#/components/parameters/AdminUntil"
|
||||
- $ref: "#/components/parameters/AdminLedgerType"
|
||||
- $ref: "#/components/parameters/AdminCreatedAtSort"
|
||||
- $ref: "#/components/parameters/AdminSortOrder"
|
||||
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 }
|
||||
"400": { description: Filter, sort, limit, or cursor is malformed }
|
||||
"403": { description: ANALYST role cannot access credit ledger records }
|
||||
/v1/admin/credits/grants:
|
||||
post:
|
||||
@@ -758,14 +782,33 @@ paths:
|
||||
in: query
|
||||
schema: { type: string, maxLength: 256 }
|
||||
- $ref: "#/components/parameters/Limit"
|
||||
- $ref: "#/components/parameters/AdminFrom"
|
||||
- $ref: "#/components/parameters/AdminUntil"
|
||||
- name: role
|
||||
in: query
|
||||
schema: { type: string, enum: [SUPER_ADMIN, SUPPORT, ANALYST] }
|
||||
- name: enabled
|
||||
in: query
|
||||
schema: { type: boolean }
|
||||
- name: locked
|
||||
in: query
|
||||
description: Whether locked_until is later than the request time.
|
||||
schema: { type: boolean }
|
||||
- name: sort
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
enum: [createdAt, username, lastLoginAt]
|
||||
default: createdAt
|
||||
- $ref: "#/components/parameters/AdminSortOrder"
|
||||
responses:
|
||||
"200":
|
||||
description: Operators ordered by creation time
|
||||
description: Operators ordered by the requested stable sort and operator ID; null lastLoginAt values are last
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/AdminOperatorPage" }
|
||||
"403": { description: INSUFFICIENT_PERMISSION; SUPER_ADMIN is required }
|
||||
"400": { description: Cursor or limit is malformed }
|
||||
"400": { description: Filter, sort, limit, or cursor is malformed }
|
||||
post:
|
||||
security:
|
||||
- adminMtls: []
|
||||
@@ -874,13 +917,35 @@ paths:
|
||||
in: query
|
||||
schema: { type: string, maxLength: 256 }
|
||||
- $ref: "#/components/parameters/Limit"
|
||||
- $ref: "#/components/parameters/AdminFrom"
|
||||
- $ref: "#/components/parameters/AdminUntil"
|
||||
- name: action
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- LOGIN_SUCCEEDED
|
||||
- LOGIN_FAILED
|
||||
- SESSION_REVOKED
|
||||
- OPERATOR_CREATED
|
||||
- OPERATOR_ENABLED
|
||||
- OPERATOR_DISABLED
|
||||
- OPERATOR_UNLOCKED
|
||||
- OPERATOR_CREDENTIALS_RESET
|
||||
- OPERATOR_SESSIONS_REVOKED
|
||||
- MANUAL_CREDIT_GRANTED
|
||||
- name: result
|
||||
in: query
|
||||
schema: { type: string, enum: [success, rejected] }
|
||||
- $ref: "#/components/parameters/AdminCreatedAtSort"
|
||||
- $ref: "#/components/parameters/AdminSortOrder"
|
||||
responses:
|
||||
"200":
|
||||
description: Recent audit events
|
||||
content:
|
||||
application/json:
|
||||
schema: { $ref: "#/components/schemas/AdminAuditPage" }
|
||||
"400": { description: Cursor is malformed }
|
||||
"400": { description: Filter, sort, limit, or cursor is malformed }
|
||||
"403": { description: Super-administrator role is required }
|
||||
components:
|
||||
securitySchemes:
|
||||
@@ -919,6 +984,34 @@ components:
|
||||
name: range
|
||||
in: query
|
||||
schema: { type: string, enum: [7d, 30d, 90d], default: 30d }
|
||||
AdminFrom:
|
||||
name: from
|
||||
in: query
|
||||
description: Inclusive UTC lower bound. When both bounds are present, from must be earlier than until.
|
||||
schema: { type: string, format: date-time }
|
||||
AdminUntil:
|
||||
name: until
|
||||
in: query
|
||||
description: Exclusive UTC upper bound.
|
||||
schema: { type: string, format: date-time }
|
||||
AdminCreatedAtSort:
|
||||
name: sort
|
||||
in: query
|
||||
schema: { type: string, enum: [createdAt], default: createdAt }
|
||||
AdminSortOrder:
|
||||
name: order
|
||||
in: query
|
||||
schema: { type: string, enum: [asc, desc] }
|
||||
AdminLedgerType:
|
||||
name: type
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
enum: [grant, reserve, settle, refund, adjustment]
|
||||
AdminLedgerLimit:
|
||||
name: limit
|
||||
in: query
|
||||
schema: { type: integer, minimum: 1, maximum: 100, default: 100 }
|
||||
AdminUserId:
|
||||
name: userId
|
||||
in: path
|
||||
|
||||
Reference in New Issue
Block a user