Finished up with css-only flair implementation.
This commit is contained in:
parent
5b5f495853
commit
9dbbc4e924
13 changed files with 231 additions and 60 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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}'!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue