mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
fix: handle bracket notation arrays (#2178)
Co-authored-by: David Nguyen <davidngu28@gmail.com>
This commit is contained in:
@ -41,10 +41,14 @@ export const createAttachmentRoute = authenticatedProcedure
|
||||
type: EnvelopeType.DOCUMENT,
|
||||
});
|
||||
|
||||
await createAttachment({
|
||||
const attachment = await createAttachment({
|
||||
envelopeId: envelope.id,
|
||||
teamId,
|
||||
userId,
|
||||
data,
|
||||
});
|
||||
|
||||
return {
|
||||
id: attachment.id,
|
||||
};
|
||||
});
|
||||
|
||||
@ -8,7 +8,9 @@ export const ZCreateAttachmentRequestSchema = z.object({
|
||||
}),
|
||||
});
|
||||
|
||||
export const ZCreateAttachmentResponseSchema = z.void();
|
||||
export const ZCreateAttachmentResponseSchema = z.object({
|
||||
id: z.string(),
|
||||
});
|
||||
|
||||
export type TCreateAttachmentRequest = z.infer<typeof ZCreateAttachmentRequestSchema>;
|
||||
export type TCreateAttachmentResponse = z.infer<typeof ZCreateAttachmentResponseSchema>;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { deleteAttachment } from '@documenso/lib/server-only/envelope-attachment/delete-attachment';
|
||||
|
||||
import { ZGenericSuccessResponse } from '../../schema';
|
||||
import { authenticatedProcedure } from '../../trpc';
|
||||
import {
|
||||
ZDeleteAttachmentRequestSchema,
|
||||
@ -33,4 +34,6 @@ export const deleteAttachmentRoute = authenticatedProcedure
|
||||
userId,
|
||||
teamId,
|
||||
});
|
||||
|
||||
return ZGenericSuccessResponse;
|
||||
});
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { ZSuccessResponseSchema } from '../../schema';
|
||||
|
||||
export const ZDeleteAttachmentRequestSchema = z.object({
|
||||
id: z.string(),
|
||||
});
|
||||
|
||||
export const ZDeleteAttachmentResponseSchema = z.void();
|
||||
export const ZDeleteAttachmentResponseSchema = ZSuccessResponseSchema;
|
||||
|
||||
export type TDeleteAttachmentRequest = z.infer<typeof ZDeleteAttachmentRequestSchema>;
|
||||
export type TDeleteAttachmentResponse = z.infer<typeof ZDeleteAttachmentResponseSchema>;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { updateAttachment } from '@documenso/lib/server-only/envelope-attachment/update-attachment';
|
||||
|
||||
import { ZGenericSuccessResponse } from '../../schema';
|
||||
import { authenticatedProcedure } from '../../trpc';
|
||||
import {
|
||||
ZUpdateAttachmentRequestSchema,
|
||||
@ -34,4 +35,6 @@ export const updateAttachmentRoute = authenticatedProcedure
|
||||
teamId,
|
||||
data,
|
||||
});
|
||||
|
||||
return ZGenericSuccessResponse;
|
||||
});
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { ZSuccessResponseSchema } from '../../schema';
|
||||
|
||||
export const ZUpdateAttachmentRequestSchema = z.object({
|
||||
id: z.string(),
|
||||
data: z.object({
|
||||
@ -8,7 +10,7 @@ export const ZUpdateAttachmentRequestSchema = z.object({
|
||||
}),
|
||||
});
|
||||
|
||||
export const ZUpdateAttachmentResponseSchema = z.void();
|
||||
export const ZUpdateAttachmentResponseSchema = ZSuccessResponseSchema;
|
||||
|
||||
export type TUpdateAttachmentRequest = z.infer<typeof ZUpdateAttachmentRequestSchema>;
|
||||
export type TUpdateAttachmentResponse = z.infer<typeof ZUpdateAttachmentResponseSchema>;
|
||||
|
||||
Reference in New Issue
Block a user