Added user rank changes to admin page.

This commit is contained in:
rainbownapkin 2024-11-17 17:37:07 -05:00
parent 064109556c
commit 8a4a21cff0
13 changed files with 276 additions and 30 deletions

View file

@ -17,6 +17,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
//NPM Imports
const { check, body, checkSchema, checkExact} = require('express-validator');
//local imports
const permissionSchema = require("../schemas/permissionSchema");
function isRank(value){
rankVal = permissionSchema.rankToNum(value);
return rankVal != -1;
}
module.exports.accountValidator = {
user: (field = 'user') => body(field).escape().trim().isLength({min: 1, max: 22}),
@ -32,6 +41,8 @@ module.exports.accountValidator = {
signature: (field = 'signature') => body(field).optional().escape().trim().isLength({min: 1, max: 150}),
bio: (field = 'bio') => body(field).optional().escape().trim().isLength({min: 1, max: 1000}),
rank: (field = 'rank') => body(field).escape().trim().custom(isRank)
}
module.exports.channelValidator = {