refactor: migrate to monorepo structure with Docker, PocketBase, and e2e tests
- Reorganize into apps/, packages/, docs/, e2e/, pocketbase/ directories - Add Dockerfiles for web, worker, and PocketBase services - Add docker-compose.yml for local orchestration - Add turbo.json for monorepo task management - Add Playwright e2e test infrastructure - Add PocketBase backend with migrations - Remove Vite/Next.js/ESLint/PostCSS config files - Update package.json with workspace dependencies - Add .env.example and .dockerignore
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
// ── Sub-schemas ──────────────────────────────────────────────────────────────
|
||||
|
||||
export const webhookDeliverySchema = z.object({
|
||||
id: z.string(),
|
||||
webhook_id: z.string(),
|
||||
event: z.string(),
|
||||
payload: z.record(z.unknown()),
|
||||
status: z.enum(['success', 'failed', 'pending']).default('pending'),
|
||||
status_code: z.number().int().optional(),
|
||||
response_body: z.string().optional(),
|
||||
error_message: z.string().optional(),
|
||||
attempts: z.number().int().nonnegative().default(0),
|
||||
delivered_at: z.string().datetime().optional(),
|
||||
created: z.string().datetime(),
|
||||
updated: z.string().datetime(),
|
||||
});
|
||||
|
||||
// ── Webhook Schema ───────────────────────────────────────────────────────────
|
||||
|
||||
export const webhookSchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string().min(1, 'Webhook name is required'),
|
||||
url: z.string().url('Invalid webhook URL'),
|
||||
events: z.array(z.string()).min(1, 'At least one event is required'),
|
||||
secret: z.string().optional(),
|
||||
active: z.boolean().default(true),
|
||||
domain: z.string(),
|
||||
headers: z.record(z.string()).optional(),
|
||||
retry_count: z.number().int().nonnegative().default(3),
|
||||
last_triggered_at: z.string().datetime().optional(),
|
||||
custom_fields: z.record(z.unknown()).optional(),
|
||||
created: z.string().datetime(),
|
||||
updated: z.string().datetime(),
|
||||
});
|
||||
|
||||
export const createWebhookSchema = webhookSchema.omit({
|
||||
id: true,
|
||||
last_triggered_at: true,
|
||||
created: true,
|
||||
updated: true,
|
||||
});
|
||||
|
||||
export const updateWebhookSchema = createWebhookSchema.partial();
|
||||
|
||||
// ── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
export type Webhook = z.infer<typeof webhookSchema>;
|
||||
export type CreateWebhook = z.infer<typeof createWebhookSchema>;
|
||||
export type UpdateWebhook = z.infer<typeof updateWebhookSchema>;
|
||||
export type WebhookDelivery = z.infer<typeof webhookDeliverySchema>;
|
||||
Reference in New Issue
Block a user