Adds 5 new document types (PLAN, REGISTER, RECORD, REPORT, TEMPLATE), renames ISMS to GOVERNANCE, and implements type-based filtering across GraphQL, MCP, and frontend. Includes migration, enum updates, filter implementation with SQL array support, and frontend dropdown UI with Relay refetch pattern. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
21 lines
698 B
TypeScript
21 lines
698 B
TypeScript
import { z } from "zod";
|
|
|
|
import { useFormWithSchema } from "../useFormWithSchema";
|
|
|
|
export const documentSchema = z.object({
|
|
title: z.string().min(1, "Title is required"),
|
|
content: z.string().min(1, "Content is required"),
|
|
approverIds: z.array(z.string()).min(1, "At least one approver is required"),
|
|
documentType: z.enum(["OTHER", "GOVERNANCE", "POLICY", "PROCEDURE", "PLAN", "REGISTER", "RECORD", "REPORT", "TEMPLATE"]),
|
|
classification: z.enum(["PUBLIC", "INTERNAL", "CONFIDENTIAL", "SECRET"]),
|
|
});
|
|
|
|
export const useDocumentForm = () => {
|
|
return useFormWithSchema(documentSchema, {
|
|
defaultValues: {
|
|
documentType: "POLICY",
|
|
classification: "INTERNAL",
|
|
},
|
|
});
|
|
};
|