fix(scrape-events): bad logic

This commit is contained in:
Gergo Moricz 2024-07-24 14:46:41 +02:00
parent 7cd9bf92e3
commit 71072fef3b

View File

@ -13,7 +13,7 @@ export type ScrapeScrapeEvent = {
result: null | { result: null | {
success: boolean, success: boolean,
response_code?: number, response_code?: number,
error?: string, error?: string | object,
// proxy?: string, // proxy?: string,
time_taken: number, time_taken: number,
}, },
@ -31,13 +31,13 @@ export class ScrapeEvents {
static async insert(jobId: string, content: ScrapeEvent) { static async insert(jobId: string, content: ScrapeEvent) {
if (jobId === "TEST") return null; if (jobId === "TEST") return null;
if (process.env.USE_DB_AUTH) { if (process.env.USE_DB_AUTHENTICATION) {
const result = await supabase.from("scrape_events").insert({ const result = await supabase.from("scrape_events").insert({
job_id: jobId, job_id: jobId,
type: content.type, type: content.type,
content: content, content: content,
// created_at // created_at
}).single(); }).select().single();
return (result.data as any).id; return (result.data as any).id;
} }