feat(documents): Phase A schema + service skeletons
Adds Phase A data model deltas to documents/templates and the new document_watchers table. Introduces createFromWizard/createFromUpload stubs, getDocumentDetail aggregator, cancelDocument flow, signed-doc email composer, reservation agreement context, and notifyDocumentEvent fan-out. Validator update accepts new template formats with html-only bodyHtml requirement. EOI cadence backfilled to 1 day to preserve current effective behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,9 @@ const mergeFieldsSchema = z
|
||||
},
|
||||
);
|
||||
|
||||
export const createTemplateSchema = z.object({
|
||||
export const templateFormats = ['html', 'pdf_form', 'pdf_overlay', 'documenso_render'] as const;
|
||||
|
||||
const createTemplateBaseSchema = z.object({
|
||||
name: z.string().min(1).max(200),
|
||||
description: z.string().max(500).optional(),
|
||||
templateType: z.enum([
|
||||
@@ -26,12 +28,18 @@ export const createTemplateSchema = z.object({
|
||||
'correspondence',
|
||||
'custom',
|
||||
]),
|
||||
bodyHtml: z.string().min(1),
|
||||
templateFormat: z.enum(templateFormats).default('html'),
|
||||
bodyHtml: z.string().min(1).optional(),
|
||||
mergeFields: mergeFieldsSchema,
|
||||
isActive: z.boolean().default(true),
|
||||
});
|
||||
|
||||
export const updateTemplateSchema = createTemplateSchema.partial();
|
||||
export const createTemplateSchema = createTemplateBaseSchema.refine(
|
||||
(data) => data.templateFormat !== 'html' || (data.bodyHtml && data.bodyHtml.length > 0),
|
||||
{ path: ['bodyHtml'], message: 'bodyHtml is required when templateFormat is html' },
|
||||
);
|
||||
|
||||
export const updateTemplateSchema = createTemplateBaseSchema.partial();
|
||||
|
||||
export const listTemplatesSchema = baseListQuerySchema.extend({
|
||||
templateType: z.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user