mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 03:01:59 +10:00
chore: remove same email check from backend
This commit is contained in:
@ -96,29 +96,19 @@ export const ZDeleteDocumentRecipientRequestSchema = z.object({
|
|||||||
recipientId: z.number(),
|
recipientId: z.number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ZSetDocumentRecipientsRequestSchema = z
|
export const ZSetDocumentRecipientsRequestSchema = z.object({
|
||||||
.object({
|
documentId: z.number(),
|
||||||
documentId: z.number(),
|
recipients: z.array(
|
||||||
recipients: z.array(
|
z.object({
|
||||||
z.object({
|
nativeId: z.number().optional(),
|
||||||
nativeId: z.number().optional(),
|
email: z.string().toLowerCase().email().min(1),
|
||||||
email: z.string().toLowerCase().email().min(1),
|
name: z.string(),
|
||||||
name: z.string(),
|
role: z.nativeEnum(RecipientRole),
|
||||||
role: z.nativeEnum(RecipientRole),
|
signingOrder: z.number().optional(),
|
||||||
signingOrder: z.number().optional(),
|
actionAuth: ZRecipientActionAuthTypesSchema.optional().nullable(),
|
||||||
actionAuth: ZRecipientActionAuthTypesSchema.optional().nullable(),
|
}),
|
||||||
}),
|
),
|
||||||
),
|
});
|
||||||
})
|
|
||||||
.refine(
|
|
||||||
(schema) => {
|
|
||||||
const emails = schema.recipients.map((recipient) => recipient.email.toLowerCase());
|
|
||||||
|
|
||||||
return new Set(emails).size === emails.length;
|
|
||||||
},
|
|
||||||
// Dirty hack to handle errors when .root is populated for an array type
|
|
||||||
{ message: 'Recipients must have unique emails', path: ['recipients__root'] },
|
|
||||||
);
|
|
||||||
|
|
||||||
export const ZSetDocumentRecipientsResponseSchema = z.object({
|
export const ZSetDocumentRecipientsResponseSchema = z.object({
|
||||||
recipients: ZRecipientLiteSchema.array(),
|
recipients: ZRecipientLiteSchema.array(),
|
||||||
|
|||||||
Reference in New Issue
Block a user