From 95edf82d27ccd7d47d8276f6e0f93d9ad3aa153f Mon Sep 17 00:00:00 2001 From: David Meir-Levy Date: Wed, 22 May 2024 07:52:02 +0300 Subject: [PATCH] filter tags --- endpoints.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/endpoints.ts b/endpoints.ts index 7d7f00c..f568ecf 100644 --- a/endpoints.ts +++ b/endpoints.ts @@ -19,7 +19,10 @@ createCrud({ return data; }, readMany: async (query, { tenantPayload }) => { - console.log(tenantPayload) + const dbQuery: any = { tenant: tenantPayload.sub }; + if (query.tags) { + dbQuery.tags = query.tags + } return events.find({ tenant: tenantPayload.sub }).toArray() }, updateOne: async (_id, body: EventDoc, { user, tenantPayload }) => {