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.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { z } from 'zod';
|
|
import { WebhookEventName } from './enums.js';
|
|
import { PaginationQuery } from './pagination.js';
|
|
|
|
export const CreateWebhookSubscriptionRequest = z.object({
|
|
url: z.string().url().max(2048),
|
|
events: z.array(WebhookEventName).min(1),
|
|
active: z.boolean().optional(),
|
|
});
|
|
export type CreateWebhookSubscriptionRequest = z.infer<typeof CreateWebhookSubscriptionRequest>;
|
|
|
|
export const UpdateWebhookSubscriptionRequest = z
|
|
.object({
|
|
url: z.string().url().max(2048).optional(),
|
|
events: z.array(WebhookEventName).min(1).optional(),
|
|
active: z.boolean().optional(),
|
|
})
|
|
.refine((v) => Object.keys(v).length > 0, { message: 'At least one field required' });
|
|
export type UpdateWebhookSubscriptionRequest = z.infer<typeof UpdateWebhookSubscriptionRequest>;
|
|
|
|
export const WebhookSubscriptionListQuery = PaginationQuery.extend({
|
|
active: z
|
|
.union([z.literal('true'), z.literal('false'), z.boolean()])
|
|
.transform((v) => v === true || v === 'true')
|
|
.optional(),
|
|
});
|
|
export type WebhookSubscriptionListQuery = z.infer<typeof WebhookSubscriptionListQuery>;
|