mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-02-21 01:18:52 -06:00
Merge pull request #239 from bluewave-labs/feat/user-roles
Added role field to User model, resolves #233
This commit is contained in:
@@ -31,6 +31,11 @@ const UserSchema = mongoose.Schema(
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
role: {
|
||||
type: String,
|
||||
default: "user",
|
||||
enum: ["user", "admin"],
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
|
||||
@@ -14,6 +14,7 @@ const registerValidation = joi.object({
|
||||
lastname: joi.string().required(),
|
||||
email: joi.string().email().required(),
|
||||
password: joi.string().min(8).required(),
|
||||
role: joi.string().required(),
|
||||
});
|
||||
|
||||
const editUserParamValidation = joi.object({
|
||||
@@ -24,6 +25,7 @@ const editUserBodyValidation = joi.object({
|
||||
firstname: joi.string(),
|
||||
lastname: joi.string(),
|
||||
profilePicUrl: joi.string(),
|
||||
role: joi.string(),
|
||||
});
|
||||
|
||||
const recoveryValidation = joi.object({
|
||||
|
||||
Reference in New Issue
Block a user