Update supabase-jobs.ts

This commit is contained in:
Nicolas 2024-08-30 14:52:59 -03:00
parent 2fd9c285bd
commit 234c6daee8

View File

@ -1,10 +1,12 @@
import { supabase_service } from "../services/supabase";
import { Logger } from "./logger";
import * as Sentry from "@sentry/node";
export const supabaseGetJobById = async (jobId: string) => {
const { data, error } = await supabase_service
.from('firecrawl_jobs')
.select('*')
.eq('job_id', jobId)
.from("firecrawl_jobs")
.select("*")
.eq("job_id", jobId)
.single();
if (error) {
@ -16,15 +18,16 @@ export const supabaseGetJobById = async (jobId: string) => {
}
return data;
}
};
export const supabaseGetJobsById = async (jobIds: string[]) => {
const { data, error } = await supabase_service
.from('firecrawl_jobs')
.select('*')
.in('job_id', jobIds);
const { data, error } = await supabase_service.rpc("get_jobs_by_ids", {
job_ids: jobIds,
});
if (error) {
Logger.error(`Error in get_jobs_by_ids: ${error}`);
Sentry.captureException(error);
return [];
}
@ -33,5 +36,4 @@ export const supabaseGetJobsById = async (jobIds: string[]) => {
}
return data;
}
};