Sindbad~EG File Manager

Current Path : /home/infinitibizsol/.trash/models.2/
Upload File :
Current File : /home/infinitibizsol/.trash/models.2/vehicleRun.js

module.exports = (sequelize, DataTypes) => {
  const vehicleRun = sequelize.define(
    "tblVehicleRun",
    {
      vehicle_run_id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },
      vehicle_id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        validate: {
          notNull: {
            args: true,
            msg: "The vehicle_id cannot be null",
          },
        },
      },
      opportunity_id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        validate: {
          notNull: {
            args: true,
            msg: "The opportunity_id cannot be null",
          },
        },
      },
      //Red=1
      //Yellow=2
      //Green=3
      condition_light: {
        type: DataTypes.INTEGER,
        defaultValue: 4,
        validate: {
          isIn: {
            args: [[1, 2, 3, 4]],
            msg: "condition_light must be 1, 2, 3, or 4", // Custom error message
          },
        },
      },

      announcements: {
        type: DataTypes.STRING,
        allowNull: true,
      },

      reserve: {
        type: DataTypes.FLOAT,
        allowNull: true,
      },

      sale_price: {
        type: DataTypes.FLOAT,
        allowNull: true,
      },

      vehicle_total_fee: {
        type: DataTypes.FLOAT,
        allowNull: true,
      },
      net_proceeds: {
        type: DataTypes.FLOAT,
        allowNull: true,
      },
      sale_status: {
        type: DataTypes.BOOLEAN,
        defaultValue: false,
      },

      run_no: {
        type: DataTypes.STRING,
        allowNull: true,
      },

      lane_id: {
        type: DataTypes.INTEGER,
        allowNull: true,
      },
    },
    {
      timestamps: true,
    }
  );

  return vehicleRun;
};

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists