mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
39 lines
992 B
TypeScript
39 lines
992 B
TypeScript
import { resendDocument } from '@documenso/lib/server-only/document/resend-document';
|
|
|
|
import { ZGenericSuccessResponse } from '../schema';
|
|
import { authenticatedProcedure } from '../trpc';
|
|
import {
|
|
ZRedistributeDocumentRequestSchema,
|
|
ZRedistributeDocumentResponseSchema,
|
|
redistributeDocumentMeta,
|
|
} from './redistribute-document.types';
|
|
|
|
export const redistributeDocumentRoute = authenticatedProcedure
|
|
.meta(redistributeDocumentMeta)
|
|
.input(ZRedistributeDocumentRequestSchema)
|
|
.output(ZRedistributeDocumentResponseSchema)
|
|
.mutation(async ({ input, ctx }) => {
|
|
const { teamId } = ctx;
|
|
const { documentId, recipients } = input;
|
|
|
|
ctx.logger.info({
|
|
input: {
|
|
documentId,
|
|
recipients,
|
|
},
|
|
});
|
|
|
|
await resendDocument({
|
|
userId: ctx.user.id,
|
|
teamId,
|
|
id: {
|
|
type: 'documentId',
|
|
id: documentId,
|
|
},
|
|
recipients,
|
|
requestMetadata: ctx.metadata,
|
|
});
|
|
|
|
return ZGenericSuccessResponse;
|
|
});
|