From 98d82c4cec4bc05c84df2259fd3bdf6acc6813bc Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 6 Jun 2024 20:02:21 -0700 Subject: [PATCH] Update search.ts --- apps/api/src/controllers/search.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/api/src/controllers/search.ts b/apps/api/src/controllers/search.ts index a73c625..7474aae 100644 --- a/apps/api/src/controllers/search.ts +++ b/apps/api/src/controllers/search.ts @@ -43,8 +43,21 @@ export async function searchHelper( }); let justSearch = pageOptions.fetchPageContent === false; + if (justSearch) { + const billingResult = await billTeam( + team_id, + res.length + ); + if (!billingResult.success) { + return { + success: false, + error: + "Failed to bill team. Insufficient credits or subscription not found.", + returnCode: 402, + }; + } return { success: true, data: res, returnCode: 200 }; }