mirror of
https://github.com/documenso/documenso.git
synced 2026-07-14 06:47:10 +10:00
35 lines
810 B
TypeScript
35 lines
810 B
TypeScript
import { getEnvelopesByIds } from '@documenso/lib/server-only/envelope/get-envelopes-by-ids';
|
|
|
|
import { authenticatedProcedure } from '../trpc';
|
|
import {
|
|
getEnvelopesByIdsMeta,
|
|
ZGetEnvelopesByIdsRequestSchema,
|
|
ZGetEnvelopesByIdsResponseSchema,
|
|
} from './get-envelopes-by-ids.types';
|
|
|
|
export const getEnvelopesByIdsRoute = authenticatedProcedure
|
|
.meta(getEnvelopesByIdsMeta)
|
|
.input(ZGetEnvelopesByIdsRequestSchema)
|
|
.output(ZGetEnvelopesByIdsResponseSchema)
|
|
.mutation(async ({ input, ctx }) => {
|
|
const { teamId, user } = ctx;
|
|
const { ids } = input;
|
|
|
|
ctx.logger.info({
|
|
input: {
|
|
ids,
|
|
},
|
|
});
|
|
|
|
const envelopes = await getEnvelopesByIds({
|
|
ids,
|
|
userId: user.id,
|
|
teamId,
|
|
type: null,
|
|
});
|
|
|
|
return {
|
|
data: envelopes,
|
|
};
|
|
});
|