17 lines
500 B
TypeScript
17 lines
500 B
TypeScript
import { NextFunction, Request, Response } from "express";
|
|
|
|
const validateJobRequest = (req: Request, res: Response, next: NextFunction) => {
|
|
try {
|
|
const jobid: string = (req.body.jobid || "").trim();
|
|
if (!jobid) {
|
|
res.status(400).json({ error: "No RO Number has been specified." });
|
|
return;
|
|
}
|
|
next();
|
|
} catch (error) {
|
|
res.status(500).json({ error: "Error validating job request.", details: (error as Error).message });
|
|
}
|
|
};
|
|
|
|
export default validateJobRequest;
|