mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
This PR is handles the changes required to support envelopes. The new envelope editor/signing page will be hidden during release. The core changes here is to migrate the documents and templates model to a centralized envelopes model. Even though Documents and Templates are removed, from the user perspective they will still exist as we remap envelopes to documents and templates.
20 lines
688 B
TypeScript
20 lines
688 B
TypeScript
import { adminFindDocuments } from '@documenso/lib/server-only/admin/admin-find-documents';
|
|
import { mapEnvelopesToDocumentMany } from '@documenso/lib/utils/document';
|
|
|
|
import { adminProcedure } from '../trpc';
|
|
import { ZFindDocumentsRequestSchema, ZFindDocumentsResponseSchema } from './find-documents.types';
|
|
|
|
export const findDocumentsRoute = adminProcedure
|
|
.input(ZFindDocumentsRequestSchema)
|
|
.output(ZFindDocumentsResponseSchema)
|
|
.query(async ({ input }) => {
|
|
const { query, page, perPage } = input;
|
|
|
|
const result = await adminFindDocuments({ query, page, perPage });
|
|
|
|
return {
|
|
...result,
|
|
data: result.data.map(mapEnvelopesToDocumentMany),
|
|
};
|
|
});
|