Finished up with css-only flair implementation.

This commit is contained in:
rainbownapkin 2024-11-21 08:42:21 -05:00
parent 5b5f495853
commit 9dbbc4e924
13 changed files with 231 additions and 60 deletions

View file

@ -26,6 +26,10 @@ const flairSchema = new mongoose.Schema({
type: mongoose.SchemaTypes.String,
required: true
},
displayName:{
type: mongoose.SchemaTypes.String,
required: true
},
rank: {
type: mongoose.SchemaTypes.String,
enum: permissionModel.rankEnum,

View file

@ -105,6 +105,10 @@ userSchema.pre('save', async function (next){
//Throw a shit fit. Do not pass go. Do not collect $200.
throw new Error("Invalid flair!");
}
if(permissionModel.rankToNum(this.rank) < permissionModel.rankToNum(foundFlair.rank)){
throw new Error(`User '${this.user}' does not have a high enough rank for flair '${foundFlair.displayName}'!`);
}
}
}