+
+
Generate document
+
+ Pick a template; it will be filled with this person's data.
+
+
+
+
+
+
+ {recordId === null && (
+
+ Select a single person to generate a document.
+
+ )}
+
+
+
+
+
+
+
+ );
+};
+
+export default defineFrontComponent({
+ universalIdentifier:
+ GENERATE_DOCUMENT_FORM_FRONT_COMPONENT_UNIVERSAL_IDENTIFIER,
+ name: 'generate-document-form',
+ description: 'Form to generate a document from a template for a person.',
+ component: GenerateDocumentForm,
+});
diff --git a/packages/twenty-apps/examples/document-generator/src/logic-functions/generate-document-route.ts b/packages/twenty-apps/examples/document-generator/src/logic-functions/generate-document-route.ts
new file mode 100644
index 0000000000..dd31ddef0e
--- /dev/null
+++ b/packages/twenty-apps/examples/document-generator/src/logic-functions/generate-document-route.ts
@@ -0,0 +1,35 @@
+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk/define';
+import { Response } from 'twenty-sdk/logic-function';
+
+import { GENERATE_DOCUMENT_ROUTE_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { generateDocumentHandler } from 'src/logic-functions/handlers/generate-document-handler';
+
+// HTTP entry point used by the "Generate document" front component. The shared
+// handler returns a suggested HTTP status on failure (400/404/500); map it onto
+// the response so callers get proper status codes instead of a 200 with an error.
+const handler = async (event: RoutePayload): Promise