Only check Supabase if configured to

This commit is contained in:
Stefan Terdell 2024-07-07 15:06:31 +02:00
parent e779dbbe26
commit a2ae5f81d9

View File

@ -8,6 +8,8 @@ import { billTeam } from "../../src/services/billing/credit_billing";
export async function crawlCancelController(req: Request, res: Response) {
try {
const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === 'true';
const { success, team_id, error, status } = await authenticateUser(
req,
res,
@ -22,6 +24,7 @@ export async function crawlCancelController(req: Request, res: Response) {
}
// check if the job belongs to the team
if (useDbAuthentication) {
const { data, error: supaError } = await supabase_service
.from("bulljobs_teams")
.select("*")
@ -34,6 +37,8 @@ export async function crawlCancelController(req: Request, res: Response) {
if (data.length === 0) {
return res.status(403).json({ error: "Unauthorized" });
}
}
const jobState = await job.getState();
const { partialDocs } = await job.progress();