feat: add partner interface, admin dashboard, and unit tests
Partner flow: QR scanner component (html5-qrcode) with camera permission/not-found handling, 3-step spend flow (scan → amount entry with auto-filled max → success/error result). Admin dashboard: stats overview, grant points with debounced student search, paginated transactions table with type filters, paginated students table. Tests: comprehensive unit tests for points and auth packages — service (all paths including error branches, RS256 wrong-method), handler (all HTTP status codes via httptest), JWT round-trip, repository constructors. Auth coverage: 72.9%, points service coverage: 100%. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
50b3c4198a
commit
be2260d259
@@ -68,3 +68,44 @@ export interface PaginatedResponse<T> {
|
||||
export interface ApiError {
|
||||
error: string;
|
||||
}
|
||||
|
||||
// Returned by POST /api/v1/partner/spend on success.
|
||||
export interface SpendResult {
|
||||
status: string;
|
||||
spent: number;
|
||||
new_balance: number;
|
||||
}
|
||||
|
||||
// Transaction record as seen by an administrator (includes user email).
|
||||
export interface AdminTransaction {
|
||||
id: string;
|
||||
user_id: string;
|
||||
user_email: string;
|
||||
partner_id: string;
|
||||
amount: number;
|
||||
type: TransactionType;
|
||||
description: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
// Student record as seen by an administrator (includes created_at).
|
||||
export interface AdminStudent {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
student_id: string;
|
||||
balance: number;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
// Paginated response from GET /api/v1/admin/transactions.
|
||||
export interface AdminTransactionPage {
|
||||
transactions: AdminTransaction[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
// Paginated response from GET /api/v1/admin/users.
|
||||
export interface AdminUsersPage {
|
||||
users: AdminStudent[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user