back again...

bit of validation, some fixes, some auth corrections

scrapped graph db stuff

some misc. stuff, check the diff if you want bruh
This commit is contained in:
2024-07-24 13:38:07 +05:30
parent 2225f5db49
commit 5803c997b2
13 changed files with 370 additions and 1720 deletions

View File

@@ -2,6 +2,7 @@ const { validationResult } = require("express-validator");
const typedefs = require("../typedefs");
const { getNestedValuesString } = require("../utils/jsonTransformer");
const logger = require("../utils/logger")(module);
/**
* Refer: https://stackoverflow.com/questions/58848625/access-messages-in-express-validator
@@ -17,7 +18,7 @@ const validate = (req, res, next) => {
}
const extractedErrors = []
errors.array().map(err => extractedErrors.push({
[err.param]: err.msg
[err.path]: err.msg
}));
return res.status(400).json({

23
validators/playlists.js Normal file
View File

@@ -0,0 +1,23 @@
const { body, header, param, query } = require("express-validator");
const typedefs = require("../typedefs");
/**
* @param {typedefs.Req} req
* @param {typedefs.Res} res
* @param {typedefs.Next} next
*/
const getPlaylistDetailsValidator = async (req, res, next) => {
await query("playlist_id")
.notEmpty()
.withMessage("playlist_id not defined in query")
.isAlphanumeric()
.withMessage("playlist_id must be alphanumeric (base-62)")
.run(req);
next();
}
module.exports = {
getPlaylistDetailsValidator,
}