Files
documenso/packages/trpc/server/envelope-router/update-envelope.ts
David Nguyen 7f09ba72f4 feat: add envelopes (#2025)
This PR is handles the changes required to support envelopes. The new
envelope editor/signing page will be hidden during release.

The core changes here is to migrate the documents and templates model to
a centralized envelopes model.

Even though Documents and Templates are removed, from the user
perspective they will still exist as we remap envelopes to documents and
templates.
2025-10-14 21:56:36 +11:00

37 lines
857 B
TypeScript

import { updateEnvelope } from '@documenso/lib/server-only/envelope/update-envelope';
import { authenticatedProcedure } from '../trpc';
import {
ZUpdateEnvelopeRequestSchema,
ZUpdateEnvelopeResponseSchema,
} from './update-envelope.types';
export const updateEnvelopeRoute = authenticatedProcedure
// .meta(updateEnvelopeTrpcMeta)
.input(ZUpdateEnvelopeRequestSchema)
.output(ZUpdateEnvelopeResponseSchema)
.mutation(async ({ input, ctx }) => {
const { teamId } = ctx;
const { envelopeId, data, meta = {} } = input;
ctx.logger.info({
input: {
envelopeId,
},
});
const userId = ctx.user.id;
return await updateEnvelope({
userId,
teamId,
id: {
type: 'envelopeId',
id: envelopeId,
},
data,
meta,
requestMetadata: ctx.metadata,
});
});