frontend phase 15
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
import type { AdminVerificationQueueFilters } from './types';
|
||||
import type { PageParams } from '@/lib/api/types';
|
||||
|
||||
/**
|
||||
* React Query key factory for the verification domain. The nurse's own `status()` is the **single
|
||||
* cached source** that both B3 (checklist) and B6 (under-review) read — one query, two views. Every
|
||||
* submit/upload/run mutation invalidates `status()` so the checklist re-renders from cache with no
|
||||
* manual refetch. The public `badge(nurseId)` is longer-lived and reused by search/f6.
|
||||
*
|
||||
* The admin subtree (`admin()` → queue / case / document-url) mirrors the same hierarchy: each queue
|
||||
* variant (filters+params) and each case keys independently, and the `adminQueues()` / `adminCases()`
|
||||
* prefixes let a decision invalidate every queue page and a single case in one call.
|
||||
*/
|
||||
export const verificationKeys = {
|
||||
all: ['verification'] as const,
|
||||
@@ -15,4 +22,21 @@ export const verificationKeys = {
|
||||
|
||||
// The public trust badge — keyed per nurse; reused by the own-profile view and f6 search/profile.
|
||||
badge: (nurseId: number) => [...verificationKeys.all, 'badge', nurseId] as const,
|
||||
|
||||
// --- Admin review queue (b6 AdminVerificationsController) ---
|
||||
admin: () => [...verificationKeys.all, 'admin'] as const,
|
||||
|
||||
// The review queue — `filters` + `params` are part of the key, so paging / changing the status filter
|
||||
// never refetches a page already in cache (React Query hashes keys deterministically).
|
||||
adminQueues: () => [...verificationKeys.admin(), 'queue'] as const,
|
||||
adminQueue: (filters: AdminVerificationQueueFilters, params: PageParams) =>
|
||||
[...verificationKeys.adminQueues(), filters, params] as const,
|
||||
|
||||
// A single nurse's full case — invalidated on every decide / approve / reject.
|
||||
adminCases: () => [...verificationKeys.admin(), 'case'] as const,
|
||||
adminCase: (nurseVerificationId: number) => [...verificationKeys.adminCases(), nurseVerificationId] as const,
|
||||
|
||||
// A document's short-lived signed URL — keyed per document; kept out of long-term cache (fetched on demand).
|
||||
adminDocumentUrls: () => [...verificationKeys.admin(), 'document_url'] as const,
|
||||
adminDocumentUrl: (documentId: number) => [...verificationKeys.adminDocumentUrls(), documentId] as const,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user