Spaces:
Sleeping
Sleeping
Download apps/api/src/controllers/v0/admin/acuc-cache-clear.ts from s-eto-hub/firecrawl-api: direct link, hf CLI and curl.
- Browser
- Download file 904 Bytes
-
https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/api/src/controllers/v0/admin/acuc-cache-clear.ts
- Command line
-
hf download hf://spaces/s-eto-hub/firecrawl-api/apps/api/src/controllers/v0/admin/acuc-cache-clear.ts
-
curl -L -o acuc-cache-clear.ts https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/api/src/controllers/v0/admin/acuc-cache-clear.ts
904 Bytes
| import { Request, Response } from "express"; | |
| import { supabase_service } from "../../../services/supabase"; | |
| import { clearACUC, clearACUCTeam } from "../../auth"; | |
| import { logger } from "../../../lib/logger"; | |
| export async function acucCacheClearController(req: Request, res: Response) { | |
| try { | |
| const team_id: string = req.body.team_id; | |
| if (!team_id) { | |
| return res.status(400).json({ error: "team_id is required" }); | |
| } | |
| const keys = await supabase_service | |
| .from("api_keys") | |
| .select("*") | |
| .eq("team_id", team_id); | |
| await Promise.all((keys.data ?? []).map(x => clearACUC(x.key))); | |
| await clearACUCTeam(team_id); | |
| logger.info(`ACUC cache cleared for team ${team_id}`); | |
| res.json({ ok: true }); | |
| } catch (error) { | |
| logger.error(`Error clearing ACUC cache via API route: ${error}`); | |
| res.status(500).json({ error: "Internal server error" }); | |
| } | |
| } | |