chore: update routes

trying to add the route for creating documents
This commit is contained in:
Catalin Pit
2023-12-06 15:27:30 +00:00
parent 936e75fd30
commit 6c5526dd49
5 changed files with 145 additions and 4 deletions

View File

@ -23,6 +23,18 @@ const DocumentSchema = z.object({
completedAt: z.date().nullable(),
});
const SendDocumentForSigningMutationSchema = z.object({
signerEmail: z.string(),
signerName: z.string().optional(),
});
const UploadDocumentSuccessfulSchema = z.object({
uploadedFile: z.object({
id: z.number(),
message: z.string(),
}),
});
const SuccessfulResponseSchema = z.object({
documents: DocumentSchema.array(),
totalPages: z.number(),
@ -66,6 +78,18 @@ export const contract = c.router(
},
summary: 'Delete a document',
},
createDocument: {
method: 'POST',
path: '/documents',
contentType: 'multipart/form-data',
body: c.type<{ file: File }>(),
responses: {
200: UploadDocumentSuccessfulSchema,
401: UnsuccessfulResponseSchema,
500: UnsuccessfulResponseSchema,
},
summary: 'Upload a new document',
},
},
{
baseHeaders: z.object({