mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
fix: envelope autosave (#2103)
This commit is contained in:
@ -24,7 +24,7 @@ export const setEnvelopeFieldsRoute = authenticatedProcedure
|
||||
},
|
||||
});
|
||||
|
||||
await match(envelopeType)
|
||||
const result = await match(envelopeType)
|
||||
.with(EnvelopeType.DOCUMENT, async () =>
|
||||
setFieldsForDocument({
|
||||
userId: ctx.user.id,
|
||||
@ -63,4 +63,11 @@ export const setEnvelopeFieldsRoute = authenticatedProcedure
|
||||
}),
|
||||
)
|
||||
.exhaustive();
|
||||
|
||||
return {
|
||||
fields: result.fields.map((field) => ({
|
||||
id: field.id,
|
||||
formId: field.formId,
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
@ -12,6 +12,7 @@ export const ZSetEnvelopeFieldsRequestSchema = z.object({
|
||||
.number()
|
||||
.optional()
|
||||
.describe('The id of the field. If not provided, a new field will be created.'),
|
||||
formId: z.string().optional().describe('A temporary ID to keep track of new fields created'),
|
||||
envelopeItemId: z.string().describe('The id of the envelope item to put the field on'),
|
||||
recipientId: z.number(),
|
||||
type: z.nativeEnum(FieldType),
|
||||
@ -45,7 +46,14 @@ export const ZSetEnvelopeFieldsRequestSchema = z.object({
|
||||
),
|
||||
});
|
||||
|
||||
export const ZSetEnvelopeFieldsResponseSchema = z.void();
|
||||
export const ZSetEnvelopeFieldsResponseSchema = z.object({
|
||||
fields: z
|
||||
.object({
|
||||
id: z.number(),
|
||||
formId: z.string().optional(),
|
||||
})
|
||||
.array(),
|
||||
});
|
||||
|
||||
export type TSetEnvelopeFieldsRequest = z.infer<typeof ZSetEnvelopeFieldsRequestSchema>;
|
||||
export type TSetEnvelopeFieldsResponse = z.infer<typeof ZSetEnvelopeFieldsResponseSchema>;
|
||||
|
||||
Reference in New Issue
Block a user