user.js 968 Bytes
'use strict'
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
    class User extends Model {
        static associate(models) {
            this.hasMany(models.Dockerfile)
        }
    }

    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
}