Skip to content

Commit

Permalink
better appraoch
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed Oct 14, 2024
1 parent feeb989 commit f0544d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/api/src/app/controllers/widget/js/get.controller.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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.');

Expand Down

0 comments on commit f0544d3

Please sign in to comment.