fix: handle bracket notation arrays (#2178)

Co-authored-by: David Nguyen <davidngu28@gmail.com>
This commit is contained in:
Lucas Smith
2025-11-12 16:38:06 +11:00
committed by GitHub
parent 378dd605b9
commit 68a3608aee
43 changed files with 137 additions and 68 deletions
@@ -21,10 +21,14 @@ export const createAttachmentRoute = authenticatedProcedure
input: { envelopeId, label: data.label },
});
await createAttachment({
const attachment = await createAttachment({
envelopeId,
teamId,
userId,
data,
});
return {
id: attachment.id,
};
});
@@ -20,7 +20,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,
@@ -26,4 +27,6 @@ export const deleteAttachmentRoute = authenticatedProcedure
userId,
teamId,
});
return ZGenericSuccessResponse;
});
@@ -1,5 +1,6 @@
import { z } from 'zod';
import { ZSuccessResponseSchema } from '../../schema';
import type { TrpcRouteMeta } from '../../trpc';
export const deleteAttachmentMeta: TrpcRouteMeta = {
@@ -16,7 +17,7 @@ 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,
@@ -27,4 +28,6 @@ export const updateAttachmentRoute = authenticatedProcedure
teamId,
data,
});
return ZGenericSuccessResponse;
});
@@ -1,5 +1,6 @@
import { z } from 'zod';
import { ZSuccessResponseSchema } from '../../schema';
import type { TrpcRouteMeta } from '../../trpc';
export const updateAttachmentMeta: TrpcRouteMeta = {
@@ -20,7 +21,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>;