From 9cc00d6a3ed5ab5894ecdcedaf8806ca1c7ec778 Mon Sep 17 00:00:00 2001 From: David Meir-Levy Date: Wed, 22 May 2024 07:49:27 +0300 Subject: [PATCH] submit button --- endpoints.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/endpoints.ts b/endpoints.ts index af9ba1e..7d7f00c 100644 --- a/endpoints.ts +++ b/endpoints.ts @@ -12,13 +12,16 @@ createCrud({ return true; }, readOne: (_id, { tenantPayload }) => events.findOne({ _id: new ObjectId(_id), tenant: tenantPayload.sub }), - createOne: async (body, { user }) => { - const data: any = { ...body, user: user._id }; + createOne: async (body, { user, tenantPayload }) => { + const data: any = { ...body, user: user._id, tenant: tenantPayload.sub }; const res = await events.insertOne(data); data._id = res.insertedId; return data; }, - readMany: (query, { tenantPayload }) => events.find({ tenant: tenantPayload.sub, tags: query.tags }).toArray(), + readMany: async (query, { tenantPayload }) => { + console.log(tenantPayload) + return events.find({ tenant: tenantPayload.sub }).toArray() + }, updateOne: async (_id, body: EventDoc, { user, tenantPayload }) => { await events.updateOne({ _id: new ObjectId(_id), @@ -72,7 +75,9 @@ createCrud({ screens: { create: { structure: ` -

Create an event

+ + Create the event here +