feat: upload template via API (#1842)

Allow users to upload templates via both v1 and v2 APIs. Similar to
uploading documents.
This commit is contained in:
Catalin Pit
2025-07-23 07:41:12 +03:00
committed by GitHub
parent 5570690b3b
commit 7a5a9eefe8
9 changed files with 322 additions and 55 deletions
+17
View File
@@ -1,5 +1,10 @@
import { initContract } from '@ts-rest/core';
import {
ZCreateTemplateV2RequestSchema,
ZCreateTemplateV2ResponseSchema,
} from '@documenso/trpc/server/template-router/schema';
import {
ZAuthorizationHeadersSchema,
ZCreateDocumentFromTemplateMutationResponseSchema,
@@ -87,6 +92,18 @@ export const ApiContractV1 = c.router(
summary: 'Upload a new document and get a presigned URL',
},
createTemplate: {
method: 'POST',
path: '/api/v1/templates',
body: ZCreateTemplateV2RequestSchema,
responses: {
200: ZCreateTemplateV2ResponseSchema,
401: ZUnsuccessfulResponseSchema,
404: ZUnsuccessfulResponseSchema,
},
summary: 'Create a new template and get a presigned URL',
},
deleteTemplate: {
method: 'DELETE',
path: '/api/v1/templates/:id',