mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 07:43:16 +10:00
36 lines
902 B
TypeScript
36 lines
902 B
TypeScript
import { resendDocument } from '@documenso/lib/server-only/document/resend-document';
|
|
|
|
import { authenticatedProcedure } from '../trpc';
|
|
import {
|
|
ZRedistributeEnvelopeRequestSchema,
|
|
ZRedistributeEnvelopeResponseSchema,
|
|
redistributeEnvelopeMeta,
|
|
} from './redistribute-envelope.types';
|
|
|
|
export const redistributeEnvelopeRoute = authenticatedProcedure
|
|
.meta(redistributeEnvelopeMeta)
|
|
.input(ZRedistributeEnvelopeRequestSchema)
|
|
.output(ZRedistributeEnvelopeResponseSchema)
|
|
.mutation(async ({ input, ctx }) => {
|
|
const { teamId } = ctx;
|
|
const { envelopeId, recipients } = input;
|
|
|
|
ctx.logger.info({
|
|
input: {
|
|
envelopeId,
|
|
recipients,
|
|
},
|
|
});
|
|
|
|
await resendDocument({
|
|
userId: ctx.user.id,
|
|
teamId,
|
|
id: {
|
|
type: 'envelopeId',
|
|
id: envelopeId,
|
|
},
|
|
recipients,
|
|
requestMetadata: ctx.metadata,
|
|
});
|
|
});
|