我发现在用户模型的 userType 属性中定义选项(客户端和管理员)很麻烦。对语法有什么建议吗?

I'm finding troubles to define the options (client & admin) in the userType attribute at user model. Any suggestions with the syntax?

我发现在用户模型的 userType 属性中定义选项(客户端和管理员)时遇到了麻烦。对语法有什么建议吗!?

制作上下文这是我现在卡住的地方



   module.exports = (sequelize)=>{
     sequelize.define('user', {
       id: {...},
       name: {...},
       lastName: {...},
       email: {...},
       password: {...},
       userType: {
         type: S.INTEGER,
         allowNull: false,
         defaultValue: 0,
         validate: {
           min: {
             args: [0],
           },
           max: {
             args: [1],
           }
         }
       }
     })
   }

使用枚举类型并传递值中的选项(已编辑)


    module.exports = (sequelize)=>{
         sequelize.define('user', {
           id: {...},
           name: {...},
           lastName: {...},
           email: {...},
           password: {...},
           userType: {
             type: S.ENUM,
             allowNull: false,
             defaultValue: 'client',
             values: ['client', 'admin'],
             validate: {
               notNull: {
                 msg: 'The type of user must be defined'
               }
             }
           }         
         })
       }