Merge pull request #239 from bluewave-labs/feat/user-roles
Added role field to User model, resolves #233
This commit is contained in:
2 files changed
+7
No files matched your search
@@ -31,6 +31,11 @@ const UserSchema = mongoose.Schema(
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
role: {
|
||||||
|
type: String,
|
||||||
|
default: "user",
|
||||||
|
enum: ["user", "admin"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timestamps: true,
|
timestamps: true,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const registerValidation = joi.object({
|
|||||||
lastname: joi.string().required(),
|
lastname: joi.string().required(),
|
||||||
email: joi.string().email().required(),
|
email: joi.string().email().required(),
|
||||||
password: joi.string().min(8).required(),
|
password: joi.string().min(8).required(),
|
||||||
|
role: joi.string().required(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const editUserParamValidation = joi.object({
|
const editUserParamValidation = joi.object({
|
||||||
@@ -24,6 +25,7 @@ const editUserBodyValidation = joi.object({
|
|||||||
firstname: joi.string(),
|
firstname: joi.string(),
|
||||||
lastname: joi.string(),
|
lastname: joi.string(),
|
||||||
profilePicUrl: joi.string(),
|
profilePicUrl: joi.string(),
|
||||||
|
role: joi.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const recoveryValidation = joi.object({
|
const recoveryValidation = joi.object({
|
||||||
|
|||||||
Reference in new issue
Block a user