mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-11 16:29:00 +08:00
fix(v1): scrape-status with GCS
This commit is contained in:
parent
252a9ccc89
commit
3ccef5fb66
@ -1,5 +1,6 @@
|
|||||||
import { Response } from "express";
|
import { Response } from "express";
|
||||||
import { supabaseGetJobByIdOnlyData } from "../../lib/supabase-jobs";
|
import { supabaseGetJobByIdOnlyData } from "../../lib/supabase-jobs";
|
||||||
|
import { getJob } from "./crawl-status";
|
||||||
|
|
||||||
export async function scrapeStatusController(req: any, res: any) {
|
export async function scrapeStatusController(req: any, res: any) {
|
||||||
const allowedTeams = [
|
const allowedTeams = [
|
||||||
@ -17,6 +18,13 @@ export async function scrapeStatusController(req: any, res: any) {
|
|||||||
|
|
||||||
const job = await supabaseGetJobByIdOnlyData(req.params.jobId);
|
const job = await supabaseGetJobByIdOnlyData(req.params.jobId);
|
||||||
|
|
||||||
|
if (!job) {
|
||||||
|
return res.status(404).json({
|
||||||
|
success: false,
|
||||||
|
error: "Job not found.",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!allowedTeams.includes(job?.team_id) ||
|
!allowedTeams.includes(job?.team_id) ||
|
||||||
job?.team_id !== req.auth.team_id
|
job?.team_id !== req.auth.team_id
|
||||||
@ -27,7 +35,10 @@ export async function scrapeStatusController(req: any, res: any) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = job?.docs[0];
|
const jobData = await getJob(req.params.jobId);
|
||||||
|
const data = Array.isArray(jobData?.returnvalue)
|
||||||
|
? jobData?.returnvalue[0]
|
||||||
|
: jobData?.returnvalue;
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
success: true,
|
success: true,
|
||||||
|
@ -76,7 +76,7 @@ export const supabaseGetJobsByCrawlId = async (crawlId: string) => {
|
|||||||
export const supabaseGetJobByIdOnlyData = async (jobId: string) => {
|
export const supabaseGetJobByIdOnlyData = async (jobId: string) => {
|
||||||
const { data, error } = await supabase_rr_service
|
const { data, error } = await supabase_rr_service
|
||||||
.from("firecrawl_jobs")
|
.from("firecrawl_jobs")
|
||||||
.select("docs, team_id")
|
.select("team_id")
|
||||||
.eq("job_id", jobId)
|
.eq("job_id", jobId)
|
||||||
.single();
|
.single();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user