From f0544d31a8d8f65db3cbb4bcc27798908ad3db1a Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 14 Oct 2024 16:54:55 +0200 Subject: [PATCH] better appraoch --- apps/api/src/app/controllers/widget/js/get.controller.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/controllers/widget/js/get.controller.ts b/apps/api/src/app/controllers/widget/js/get.controller.ts index df5898c9..153e5031 100644 --- a/apps/api/src/app/controllers/widget/js/get.controller.ts +++ b/apps/api/src/app/controllers/widget/js/get.controller.ts @@ -1,4 +1,5 @@ import { API_URL, AUTH_URL, DASHBOARD_URL, NODE_ENV, WIDGET_URL } from '@thxnetwork/api/config/secrets'; +import { QRCodeEntry } from '@thxnetwork/api/models'; import { Widget } from '@thxnetwork/api/models/Widget'; import BrandService from '@thxnetwork/api/services/BrandService'; import PoolService from '@thxnetwork/api/services/PoolService'; @@ -18,7 +19,8 @@ const controller = async (req: Request, res: Response) => { if (!pool) throw new NotFoundError('Pool not found.'); // If there are QR codes for this campaign we redirect to it's wallet equivalent - if (pool.sub === '6315fb5a40286e9d0a219ce4') { + const isQRCodeCampaign = await QRCodeEntry.exists({ accountId: pool.sub }); + if (isQRCodeCampaign) { const widget = await Widget.findOne({ poolId: req.params.id }); if (!widget) throw new NotFoundError('Widget not found.');