mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2025-12-06 06:34:06 +00:00
28 lines
766 B
JavaScript
28 lines
766 B
JavaScript
import { body, header, param, query } from "express-validator";
|
|
import * as typedefs from "../typedefs.js";
|
|
|
|
/**
|
|
* @param {typedefs.Req} req
|
|
* @param {typedefs.Res} res
|
|
* @param {typedefs.Next} next
|
|
*/
|
|
export const createLinkValidator = async (req, res, next) => {
|
|
await body("from")
|
|
.notEmpty()
|
|
.withMessage("from not defined in body")
|
|
.isURL()
|
|
.withMessage("from must be a valid link")
|
|
.run(req);
|
|
await body("to")
|
|
.notEmpty()
|
|
.withMessage("to not defined in body")
|
|
.isURL()
|
|
.withMessage("to must be a valid link")
|
|
.run(req);
|
|
next();
|
|
}
|
|
|
|
export { createLinkValidator as removeLinkValidator };
|
|
export { createLinkValidator as populateSingleLinkValidator };
|
|
export { createLinkValidator as pruneSingleLinkValidator };
|