b0e9c5d1d0
Add /hosts/:id detail page with unified timeline (HostEvents + FMs + Repairs + part arrivals/departures) and a deployed-parts table. Hosts list rows now link to the page. FM list + detail surface inline State/Stack badges next to the asset ID, with the asset ID linking to the host page. HostEvent audit model added; create/update in the hosts service now diff and log state, stack, and field changes the same way parts.ts does. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
70 lines
1.7 KiB
TypeScript
70 lines
1.7 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const PartState = z.enum([
|
|
'SPARE',
|
|
'DEPLOYED',
|
|
'BROKEN',
|
|
'PENDING_DESTRUCTION',
|
|
'PENDING_DROP_IN_CUSTODY',
|
|
'PENDING_DESTRUCTION_IN_CUSTODY',
|
|
'PENDING_REPAIR',
|
|
]);
|
|
export type PartState = z.infer<typeof PartState>;
|
|
|
|
export const HostState = z.enum(['DEPLOYED', 'DEGRADED', 'TESTING']);
|
|
export type HostState = z.infer<typeof HostState>;
|
|
|
|
export const HostStack = z.enum(['PRODUCTION', 'VETTING']);
|
|
export type HostStack = z.infer<typeof HostStack>;
|
|
|
|
export const Role = z.enum(['ADMIN', 'TECHNICIAN']);
|
|
export type Role = z.infer<typeof Role>;
|
|
|
|
export const PartEventType = z.enum([
|
|
'CREATED',
|
|
'STATE_CHANGED',
|
|
'LOCATION_CHANGED',
|
|
'FIELD_UPDATED',
|
|
'FM_OPENED',
|
|
'FM_CLOSED',
|
|
'PART_SWAPPED',
|
|
'TAG_ADDED',
|
|
'TAG_REMOVED',
|
|
]);
|
|
export type PartEventType = z.infer<typeof PartEventType>;
|
|
|
|
export const HostEventType = z.enum([
|
|
'CREATED',
|
|
'STATE_CHANGED',
|
|
'STACK_CHANGED',
|
|
'FIELD_UPDATED',
|
|
]);
|
|
export type HostEventType = z.infer<typeof HostEventType>;
|
|
|
|
export const FmStatus = z.enum(['OPEN', 'CLOSED']);
|
|
export type FmStatus = z.infer<typeof FmStatus>;
|
|
|
|
export const CsvImportStatus = z.enum([
|
|
'PENDING',
|
|
'STAGED',
|
|
'COMMITTED',
|
|
'FAILED',
|
|
'CANCELLED',
|
|
]);
|
|
export type CsvImportStatus = z.infer<typeof CsvImportStatus>;
|
|
|
|
// Catalog of webhook event names the system will emit. Stored per subscription as a JSON array.
|
|
export const WebhookEventName = z.enum([
|
|
'part.created',
|
|
'part.updated',
|
|
'part.deleted',
|
|
'part.state_changed',
|
|
'part.location_changed',
|
|
'fm.opened',
|
|
'fm.closed',
|
|
'repair.logged',
|
|
'tag.assigned',
|
|
'tag.removed',
|
|
]);
|
|
export type WebhookEventName = z.infer<typeof WebhookEventName>;
|