log.js 994 Bytes
'use strict'
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
    class Log extends Model {}

    Log.init({
        id: {
            allowNull: false,
            autoIncrement: true,
            primaryKey: true,
            type: DataTypes.INTEGER
        },
        user: {
            type: DataTypes.INTEGER
        },
        location: {
            type: DataTypes.STRING(191),
        },
        module: {
            type: DataTypes.STRING(191),
        },
        actionType: {
            type: DataTypes.STRING(191)
        },
        data: {
            type: DataTypes.JSON
        },
        after: {
            type: DataTypes.JSON
        },
        ipAddress:{
            type: DataTypes.STRING(191)
        },
        createdAt: {
            allowNull: false,
            type: DataTypes.DATE
        }
    }, {
        timestamps: true,
        updatedAt:false,
        sequelize,
        modelName: 'Log',
    });
    return Log;
};