mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 01:01:49 +10:00
feat: add envelope editor
This commit is contained in:
34
packages/trpc/server/envelope-router/duplicate-envelope.ts
Normal file
34
packages/trpc/server/envelope-router/duplicate-envelope.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { duplicateEnvelope } from '@documenso/lib/server-only/envelope/duplicate-envelope';
|
||||
|
||||
import { authenticatedProcedure } from '../trpc';
|
||||
import {
|
||||
ZDuplicateEnvelopeRequestSchema,
|
||||
ZDuplicateEnvelopeResponseSchema,
|
||||
} from './duplicate-envelope.types';
|
||||
|
||||
export const duplicateEnvelopeRoute = authenticatedProcedure
|
||||
.input(ZDuplicateEnvelopeRequestSchema)
|
||||
.output(ZDuplicateEnvelopeResponseSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
const { teamId } = ctx;
|
||||
const { envelopeId } = input;
|
||||
|
||||
ctx.logger.info({
|
||||
input: {
|
||||
envelopeId,
|
||||
},
|
||||
});
|
||||
|
||||
const duplicatedEnvelope = await duplicateEnvelope({
|
||||
userId: ctx.user.id,
|
||||
teamId,
|
||||
id: {
|
||||
type: 'envelopeId',
|
||||
id: envelopeId,
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
duplicatedEnvelopeId: duplicatedEnvelope.id,
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user