fix: add recipients filter for bin

This commit is contained in:
Ephraim Atta-Duncan
2024-06-14 10:00:14 +00:00
committed by Mythie
parent feef4b1a12
commit ea63b45a13

View File

@ -168,9 +168,24 @@ export const findDocuments = async ({
}
if (status === ExtendedDocumentStatus.BIN) {
whereClause.deletedAt = {
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
};
whereClause.OR = [
{
userId: user.id,
deletedAt: {
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
},
},
{
Recipient: {
some: {
email: user.email,
documentDeletedAt: {
gte: DateTime.now().minus({ days: 30 }).startOf('day').toJSDate(),
},
},
},
},
];
}
if (senderIds && senderIds.length > 0) {