mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 17:21:41 +10:00
fix: date filter for deleted documents
This commit is contained in:
committed by
Mythie
parent
73e375938c
commit
a9adc36732
@ -92,7 +92,13 @@ export const DocumentsDataTable = ({
|
|||||||
{
|
{
|
||||||
header: 'Status',
|
header: 'Status',
|
||||||
accessorKey: 'status',
|
accessorKey: 'status',
|
||||||
cell: ({ row }) => <DocumentStatus status={row.getValue('status')} />,
|
cell: ({ row }) => {
|
||||||
|
const status = row.original.deletedAt
|
||||||
|
? ExtendedDocumentStatus.BIN
|
||||||
|
: (row.getValue('status') as ExtendedDocumentStatus);
|
||||||
|
|
||||||
|
return <DocumentStatus status={status} />;
|
||||||
|
},
|
||||||
size: 140,
|
size: 140,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -167,6 +167,12 @@ export const findDocuments = async ({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status === ExtendedDocumentStatus.BIN) {
|
||||||
|
whereClause.deletedAt = {
|
||||||
|
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (senderIds && senderIds.length > 0) {
|
if (senderIds && senderIds.length > 0) {
|
||||||
whereClause.userId = {
|
whereClause.userId = {
|
||||||
in: senderIds,
|
in: senderIds,
|
||||||
@ -309,7 +315,7 @@ const findDocumentsFilter = (status: ExtendedDocumentStatus, user: User) => {
|
|||||||
teamId: null,
|
teamId: null,
|
||||||
status: ExtendedDocumentStatus.COMPLETED,
|
status: ExtendedDocumentStatus.COMPLETED,
|
||||||
deletedAt: {
|
deletedAt: {
|
||||||
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
|
not: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -318,7 +324,7 @@ const findDocumentsFilter = (status: ExtendedDocumentStatus, user: User) => {
|
|||||||
some: {
|
some: {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
documentDeletedAt: {
|
documentDeletedAt: {
|
||||||
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
|
not: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -510,7 +516,7 @@ const findTeamDocumentsFilter = (
|
|||||||
{
|
{
|
||||||
teamId: team.id,
|
teamId: team.id,
|
||||||
deletedAt: {
|
deletedAt: {
|
||||||
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
|
not: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -523,7 +529,7 @@ const findTeamDocumentsFilter = (
|
|||||||
email: teamEmail,
|
email: teamEmail,
|
||||||
},
|
},
|
||||||
deletedAt: {
|
deletedAt: {
|
||||||
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
|
not: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -531,7 +537,7 @@ const findTeamDocumentsFilter = (
|
|||||||
some: {
|
some: {
|
||||||
email: teamEmail,
|
email: teamEmail,
|
||||||
documentDeletedAt: {
|
documentDeletedAt: {
|
||||||
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
|
not: null,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user