1.0.14
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
|
||||
export default function BillRequestValidator(req: Request, res: Response, next: NextFunction) {
|
||||
const jobid: string = (req.body.jobid || "").trim();
|
||||
if (jobid === "") {
|
||||
res.status(400).json({ error: "No RO Number has been specified." });
|
||||
return;
|
||||
} else {
|
||||
const validateBillRequest = (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 validateBillRequest;
|
||||
Reference in New Issue
Block a user