Files
tessera/src/models/ticket.ts
Gjermund Høsøien Wiggen 9e884546f2 feat: add infrastructure foundation — scripts, schema key, new routes, model fields
- Add npm scripts for dev, migrate, seed, smoke
- Add key column to scrips table (unique short identifier)
- Register users and templates routes in server
- Set development: false in Bun.serve for production mode
- Add description and custom_fields to CreateTicketSchema
- Make owner_id nullable/optional for unassigned tickets
- Add migration for custom field key column

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 10:42:42 +02:00

25 lines
790 B
TypeScript

import type { InferSelectModel } from 'drizzle-orm';
import { z } from 'zod/v4';
import { tickets } from '../db/schema.ts';
export type Ticket = InferSelectModel<typeof tickets>;
export const CreateTicketSchema = z.object({
subject: z.string().min(1),
queue_id: z.string().uuid(),
description: z.string().trim().optional(),
custom_fields: z.record(z.string(), z.string()).optional(),
});
export const UpdateTicketSchema = z.object({
subject: z.string().min(1).optional(),
status: z.string().min(1).optional(),
owner_id: z.string().uuid().nullable().optional(),
});
export const CommentSchema = z.object({
body: z.string().min(1),
creator_id: z.string().optional().default('00000000-0000-0000-0000-000000000000'),
internal: z.boolean().optional().default(false),
});