mirror of
https://github.com/mendableai/firecrawl.git
synced 2024-11-16 03:32:22 +08:00
Update acuc-cache-clear.ts
This commit is contained in:
parent
6ed3104eb6
commit
d375bca167
|
@ -1,15 +1,22 @@
|
||||||
import { Request, Response } from "express";
|
import { Request, Response } from "express";
|
||||||
import { supabase_service } from "../../../services/supabase";
|
import { supabase_service } from "../../../services/supabase";
|
||||||
import { clearACUC } from "../../auth";
|
import { clearACUC } from "../../auth";
|
||||||
|
import { Logger } from "../../../lib/logger";
|
||||||
|
|
||||||
export async function acucCacheClearController(req: Request, res: Response) {
|
export async function acucCacheClearController(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
const team_id: string = req.body.team_id;
|
const team_id: string = req.body.team_id;
|
||||||
|
|
||||||
const keys = await supabase_service.from("api_keys")
|
const keys = await supabase_service
|
||||||
.select("*")
|
.from("api_keys")
|
||||||
.eq("team_id", team_id);
|
.select("*")
|
||||||
|
.eq("team_id", team_id);
|
||||||
await Promise.all(keys.data.map(x => clearACUC(x.key)));
|
|
||||||
|
await Promise.all(keys.data.map((x) => clearACUC(x.key)));
|
||||||
|
|
||||||
res.json({ ok: true });
|
res.json({ ok: true });
|
||||||
|
} catch (error) {
|
||||||
|
Logger.error(`Error clearing ACUC cache via API route: ${error}`);
|
||||||
|
res.status(500).json({ error: "Internal server error" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user