mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
feat: add envelopes api (#2105)
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
import { updateEnvelopeRecipients } from '@documenso/lib/server-only/recipient/update-envelope-recipients';
|
||||
|
||||
import { authenticatedProcedure } from '../../trpc';
|
||||
import {
|
||||
ZUpdateEnvelopeRecipientsRequestSchema,
|
||||
ZUpdateEnvelopeRecipientsResponseSchema,
|
||||
updateEnvelopeRecipientsMeta,
|
||||
} from './update-envelope-recipients.types';
|
||||
|
||||
export const updateEnvelopeRecipientsRoute = authenticatedProcedure
|
||||
.meta(updateEnvelopeRecipientsMeta)
|
||||
.input(ZUpdateEnvelopeRecipientsRequestSchema)
|
||||
.output(ZUpdateEnvelopeRecipientsResponseSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
const { user, teamId } = ctx;
|
||||
const { envelopeId, data: recipients } = input;
|
||||
|
||||
ctx.logger.info({
|
||||
input: {
|
||||
envelopeId,
|
||||
},
|
||||
});
|
||||
|
||||
const { recipients: data } = await updateEnvelopeRecipients({
|
||||
userId: user.id,
|
||||
teamId,
|
||||
id: {
|
||||
type: 'envelopeId',
|
||||
id: envelopeId,
|
||||
},
|
||||
recipients,
|
||||
requestMetadata: ctx.metadata,
|
||||
});
|
||||
|
||||
return {
|
||||
data,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user