user.js 911 Bytes
'use strict'
const { sequelize } = require('.')
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
    class User extends Model { }

    User.init({
        id: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        userId: {
            type: DataTypes.STRING(191),
            unique: true
        },
        password: {
            type: DataTypes.STRING(191),
        },
        name: {
            type: DataTypes.STRING(191),
        },
        phone: {
            type: DataTypes.STRING(31),
        },
        email: {
            type: DataTypes.STRING(191),
        },
        isAdmin: {
            type: DataTypes.BOOLEAN,
            allowNull: false,
            defaultValue: false,
        }
    }, {
        sequelize,
        paranoid: true,
        modelName: 'User'
    })

    return User
}