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.
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
import type {
|
|
CreateRepairJobRequest,
|
|
RepairStatus,
|
|
UpdateRepairJobRequest,
|
|
} from '@vector/shared';
|
|
import { api } from './client.js';
|
|
import { getList } from './paginated.js';
|
|
import type { RepairJob } from './types.js';
|
|
|
|
export type RepairListFilters = {
|
|
page?: number;
|
|
pageSize?: number;
|
|
status?: RepairStatus;
|
|
partId?: string;
|
|
hostId?: string;
|
|
assigneeId?: string;
|
|
openOnly?: boolean;
|
|
};
|
|
|
|
export function listRepairs(filters: RepairListFilters = {}) {
|
|
return getList<RepairJob>('/repairs', filters);
|
|
}
|
|
|
|
export async function getRepair(id: string): Promise<RepairJob> {
|
|
const res = await api.get<RepairJob>(`/repairs/${id}`);
|
|
return res.data;
|
|
}
|
|
|
|
export async function listRepairsForPart(partId: string): Promise<RepairJob[]> {
|
|
const res = await api.get<RepairJob[]>(`/parts/${partId}/repairs`);
|
|
return res.data;
|
|
}
|
|
|
|
export async function createRepair(input: CreateRepairJobRequest): Promise<RepairJob> {
|
|
const res = await api.post<RepairJob>('/repairs', input);
|
|
return res.data;
|
|
}
|
|
|
|
export async function updateRepair(
|
|
id: string,
|
|
input: UpdateRepairJobRequest,
|
|
): Promise<RepairJob> {
|
|
const res = await api.patch<RepairJob>(`/repairs/${id}`, input);
|
|
return res.data;
|
|
}
|
|
|
|
export async function deleteRepair(id: string): Promise<void> {
|
|
await api.delete(`/repairs/${id}`);
|
|
}
|