7c0d422228
Ground-up TypeScript rewrite of the Vector hardware parts inventory
system. Ships the full roadmap (Phases 0-8) in one initial commit:
- pnpm + Turbo monorepo: apps/{api,web,e2e}, packages/{db,shared,ui,config}
- Express 5 + Prisma 5 + zod validation + JWT w/ refresh-token rotation
- React 19 + Vite + shadcn/ui + TanStack Query/Table + nuqs URL state
- Repair/RMA, tags, bulk ops, saved views, CSV audit export
- Analytics dashboard on Recharts + EOL tracking
- Signed webhook subscriptions (HMAC-SHA256) with in-process emitter
- Vitest unit tests (shared schemas, api services/helpers) + Playwright skeleton
- Gitea Actions CI (lint, typecheck, test+coverage, build) + Renovate
Deferred follow-ups: Postgres cutover (data-migration script ready),
BullMQ worker for webhook delivery, @react-pdf PDF export, CSV import wizard.
81 lines
2.9 KiB
TypeScript
81 lines
2.9 KiB
TypeScript
// Hierarchical query keys for TanStack Query. Consumers should import this factory rather than
|
|
// hard-coding tuples inline so invalidations can be surgical (e.g. invalidate everything under
|
|
// `parts.list()` without touching `parts.detail(id)`).
|
|
|
|
export const queryKeys = {
|
|
auth: {
|
|
all: ['auth'] as const,
|
|
me: () => [...queryKeys.auth.all, 'me'] as const,
|
|
},
|
|
parts: {
|
|
all: ['parts'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.parts.all, 'list', filters ?? {}] as const,
|
|
detail: (id: string) => [...queryKeys.parts.all, 'detail', id] as const,
|
|
events: (id: string, filters?: Record<string, unknown>) =>
|
|
[...queryKeys.parts.all, 'events', id, filters ?? {}] as const,
|
|
},
|
|
manufacturers: {
|
|
all: ['manufacturers'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.manufacturers.all, 'list', filters ?? {}] as const,
|
|
detail: (id: string) => [...queryKeys.manufacturers.all, 'detail', id] as const,
|
|
},
|
|
sites: {
|
|
all: ['sites'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.sites.all, 'list', filters ?? {}] as const,
|
|
detail: (id: string) => [...queryKeys.sites.all, 'detail', id] as const,
|
|
},
|
|
rooms: {
|
|
all: ['rooms'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.rooms.all, 'list', filters ?? {}] as const,
|
|
},
|
|
bins: {
|
|
all: ['bins'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.bins.all, 'list', filters ?? {}] as const,
|
|
},
|
|
users: {
|
|
all: ['users'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.users.all, 'list', filters ?? {}] as const,
|
|
},
|
|
hosts: {
|
|
all: ['hosts'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.hosts.all, 'list', filters ?? {}] as const,
|
|
detail: (id: string) => [...queryKeys.hosts.all, 'detail', id] as const,
|
|
},
|
|
repairs: {
|
|
all: ['repairs'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.repairs.all, 'list', filters ?? {}] as const,
|
|
detail: (id: string) => [...queryKeys.repairs.all, 'detail', id] as const,
|
|
},
|
|
tags: {
|
|
all: ['tags'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.tags.all, 'list', filters ?? {}] as const,
|
|
},
|
|
categories: {
|
|
all: ['categories'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.categories.all, 'list', filters ?? {}] as const,
|
|
},
|
|
webhooks: {
|
|
all: ['webhooks'] as const,
|
|
list: (filters?: Record<string, unknown>) =>
|
|
[...queryKeys.webhooks.all, 'list', filters ?? {}] as const,
|
|
},
|
|
savedViews: {
|
|
all: ['savedViews'] as const,
|
|
list: (resource: string) => [...queryKeys.savedViews.all, resource] as const,
|
|
},
|
|
analytics: {
|
|
all: ['analytics'] as const,
|
|
dashboard: () => [...queryKeys.analytics.all, 'dashboard'] as const,
|
|
},
|
|
} as const;
|