2025-01-03 20:44:27 -03:00
|
|
|
import { Response } from "express";
|
2025-01-07 12:13:12 -03:00
|
|
|
import { supabaseGetJobsById } from "../../lib/supabase-jobs";
|
2025-01-03 20:44:27 -03:00
|
|
|
import { RequestWithAuth } from "./types";
|
|
|
|
|
|
|
|
|
|
export async function extractStatusController(
|
|
|
|
|
req: RequestWithAuth<{ jobId: string }, any, any>,
|
|
|
|
|
res: Response,
|
|
|
|
|
) {
|
2025-01-07 12:13:12 -03:00
|
|
|
const jobData = await supabaseGetJobsById([req.params.jobId]);
|
|
|
|
|
if (!jobData || jobData.length === 0) {
|
|
|
|
|
return res.status(404).json({
|
|
|
|
|
success: false,
|
|
|
|
|
error: "Job not found",
|
2025-01-03 20:44:27 -03:00
|
|
|
});
|
|
|
|
|
}
|
2025-01-07 12:13:12 -03:00
|
|
|
|
|
|
|
|
return res.status(200).json({
|
|
|
|
|
success: true,
|
|
|
|
|
data: jobData[0].docs,
|
|
|
|
|
});
|
2025-01-03 20:44:27 -03:00
|
|
|
}
|