mirror of
https://github.com/20kaushik02/spotify-manager.git
synced 2025-12-06 10:54:07 +00:00
- moved to typescript - axios rate limitmodule is busted, removed for now, do something else for that - sequelize-typescript - dotenv, not dotenv-flow - removed playlist details route types for API ton of minor fixes and improvements
26 lines
669 B
TypeScript
26 lines
669 B
TypeScript
import { body } from "express-validator";
|
|
import type { RequestHandler } from "express";
|
|
|
|
const createLinkValidator: RequestHandler = 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,
|
|
createLinkValidator as removeLinkValidator,
|
|
createLinkValidator as populateSingleLinkValidator,
|
|
createLinkValidator as pruneSingleLinkValidator,
|
|
};
|