Skip to content

Commit

Permalink
fix: add role
Browse files Browse the repository at this point in the history
  • Loading branch information
Beor18 committed Aug 3, 2019
1 parent 44b28f9 commit 7fb6e2c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions models/User.js
Expand Up @@ -4,6 +4,11 @@ const mongoose = require('mongoose');

const Schema = mongoose.Schema;

const rolesValidos = {
values: ['administrador', 'usuario'],
message: '{ VALUE } no es un rol valido'
}

const UserSchema = new Schema({
name: {
type: String,
Expand All @@ -20,6 +25,9 @@ const UserSchema = new Schema({
avatar: {
type: String
},
role: {
type: String, default: 'usuario', enum: rolesValidos
},
date: {
type: Date,
default: Date.now
Expand Down

0 comments on commit 7fb6e2c

Please sign in to comment.