Started improvement of validators and respective error messages

This commit is contained in:
rainbow napkin 2025-04-29 00:13:19 -04:00
parent 8305494915
commit a6228a9fd9
5 changed files with 180 additions and 22 deletions

View file

@ -42,7 +42,8 @@ const channelSchema = new mongoose.Schema({
name: {
type: mongoose.SchemaTypes.String,
required: true,
maxLength: 50,
//Calculate max length by the validator max length and the size of an escaped character
maxLength: 50 * 6,
default: 0
},
description: {

View file

@ -73,23 +73,25 @@ const userSchema = new mongoose.Schema({
required: true,
default: "/img/johnny.png"
},
//These should be larger than validator values to make room for escaped characters
bio: {
type: mongoose.SchemaTypes.String,
required: true,
maxLength: 2000,
//Calculate max length by the validator max length and the size of an escaped character
maxLength: 1000 * 6,
default: "Bio not set!"
},
pronouns:{
type: mongoose.SchemaTypes.String,
optional: true,
maxLength: 50,
//Calculate max length by the validator max length and the size of an escaped character
maxLength: 15 * 6,
default: ""
},
signature: {
type: mongoose.SchemaTypes.String,
required: true,
maxLength: 300,
//Calculate max length by the validator max length and the size of an escaped character
maxLength: 25 * 6,
default: "Signature not set!"
},
highLevel: {