mirror of
https://github.com/documenso/documenso.git
synced 2026-07-25 01:15:49 +10:00
e98b37bb10
Add a Rejected tab and an Expired pseudo-status tab to the documents list, and an orthogonal hasExpiredRecipients boolean to the public v2 document and envelope find APIs. - Add shared hasExpiredRecipient EXISTS predicate (expiresAt in the past, NOT_SIGNED, role != CC) to find-documents, get-stats and find-envelopes - Surface REJECTED in the documents tabs (backend already wired) - Add EXPIRED extended status: where-clause branches, stats count (excluded from ALL since it overlaps PENDING), status display (TimerOff/orange), tabs, and empty-state copy - Expose hasExpiredRecipients on GET /document and /envelope using an enum-transform schema to avoid the coerce "false" -> true footgun - Document that redistributing renews expired signing links - Add e2e coverage for the expired filter on both endpoints
57 lines
1.2 KiB
TypeScript
57 lines
1.2 KiB
TypeScript
import { findEnvelopes } from '@documenso/lib/server-only/envelope/find-envelopes';
|
|
|
|
import { authenticatedProcedure } from '../trpc';
|
|
import { findEnvelopesMeta, ZFindEnvelopesRequestSchema, ZFindEnvelopesResponseSchema } from './find-envelopes.types';
|
|
|
|
export const findEnvelopesRoute = authenticatedProcedure
|
|
.meta(findEnvelopesMeta)
|
|
.input(ZFindEnvelopesRequestSchema)
|
|
.output(ZFindEnvelopesResponseSchema)
|
|
.query(async ({ input, ctx }) => {
|
|
const { user, teamId } = ctx;
|
|
|
|
const {
|
|
query,
|
|
type,
|
|
templateId,
|
|
page,
|
|
perPage,
|
|
orderByDirection,
|
|
orderByColumn,
|
|
source,
|
|
status,
|
|
hasExpiredRecipients,
|
|
folderId,
|
|
} = input;
|
|
|
|
ctx.logger.info({
|
|
input: {
|
|
query,
|
|
type,
|
|
templateId,
|
|
source,
|
|
status,
|
|
hasExpiredRecipients,
|
|
folderId,
|
|
page,
|
|
perPage,
|
|
},
|
|
});
|
|
|
|
return await findEnvelopes({
|
|
userId: user.id,
|
|
teamId,
|
|
type,
|
|
templateId,
|
|
query,
|
|
source,
|
|
status,
|
|
hasExpiredRecipients,
|
|
page,
|
|
perPage,
|
|
folderId,
|
|
orderBy: orderByColumn ? { column: orderByColumn, direction: orderByDirection } : undefined,
|
|
useWindowedCount: false,
|
|
});
|
|
});
|