mirror of
https://github.com/documenso/documenso.git
synced 2025-11-17 02:01:33 +10:00
feat: add envelope editor
This commit is contained in:
@ -259,10 +259,8 @@ export const fieldRouter = router({
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Todo: Refactor to setFieldsForDocument function.
|
||||
*/
|
||||
addFields: authenticatedProcedure
|
||||
setFieldsForDocument: authenticatedProcedure
|
||||
.input(ZSetDocumentFieldsRequestSchema)
|
||||
.output(ZSetDocumentFieldsResponseSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
@ -276,13 +274,16 @@ export const fieldRouter = router({
|
||||
});
|
||||
|
||||
return await setFieldsForDocument({
|
||||
documentId,
|
||||
userId: ctx.user.id,
|
||||
teamId,
|
||||
id: {
|
||||
type: 'documentId',
|
||||
id: documentId,
|
||||
},
|
||||
fields: fields.map((field) => ({
|
||||
id: field.nativeId,
|
||||
signerEmail: field.signerEmail,
|
||||
id: field.id,
|
||||
recipientId: field.recipientId,
|
||||
envelopeItemId: field.envelopeItemId,
|
||||
type: field.type,
|
||||
pageNumber: field.pageNumber,
|
||||
pageX: field.pageX,
|
||||
@ -508,10 +509,8 @@ export const fieldRouter = router({
|
||||
|
||||
/**
|
||||
* @private
|
||||
*
|
||||
* Todo: Refactor to setFieldsForTemplate.
|
||||
*/
|
||||
addTemplateFields: authenticatedProcedure
|
||||
setFieldsForTemplate: authenticatedProcedure
|
||||
.input(ZSetFieldsForTemplateRequestSchema)
|
||||
.output(ZSetFieldsForTemplateResponseSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
@ -525,13 +524,16 @@ export const fieldRouter = router({
|
||||
});
|
||||
|
||||
return await setFieldsForTemplate({
|
||||
templateId,
|
||||
id: {
|
||||
type: 'templateId',
|
||||
id: templateId,
|
||||
},
|
||||
userId: ctx.user.id,
|
||||
teamId,
|
||||
fields: fields.map((field) => ({
|
||||
id: field.nativeId,
|
||||
signerEmail: field.signerEmail,
|
||||
id: field.id,
|
||||
recipientId: field.recipientId,
|
||||
envelopeItemId: field.envelopeItemId,
|
||||
type: field.type,
|
||||
pageNumber: field.pageNumber,
|
||||
pageX: field.pageX,
|
||||
|
||||
@ -110,11 +110,10 @@ export const ZSetDocumentFieldsRequestSchema = z.object({
|
||||
documentId: z.number(),
|
||||
fields: z.array(
|
||||
z.object({
|
||||
formId: z.string().min(1),
|
||||
nativeId: z.number().optional(),
|
||||
id: z.number().optional(),
|
||||
type: z.nativeEnum(FieldType),
|
||||
signerEmail: z.string().min(1),
|
||||
recipientId: z.number().min(1),
|
||||
envelopeItemId: z.string(),
|
||||
pageNumber: z.number().min(1),
|
||||
pageX: z.number().min(0),
|
||||
pageY: z.number().min(0),
|
||||
@ -133,11 +132,10 @@ export const ZSetFieldsForTemplateRequestSchema = z.object({
|
||||
templateId: z.number(),
|
||||
fields: z.array(
|
||||
z.object({
|
||||
formId: z.string().min(1),
|
||||
nativeId: z.number().optional(),
|
||||
id: z.number().optional(),
|
||||
type: z.nativeEnum(FieldType),
|
||||
signerEmail: z.string().min(1),
|
||||
recipientId: z.number().min(1),
|
||||
envelopeItemId: z.string(),
|
||||
pageNumber: z.number().min(1),
|
||||
pageX: z.number().min(0),
|
||||
pageY: z.number().min(0),
|
||||
|
||||
Reference in New Issue
Block a user