UNPKG

giganet_conecta

Version:

Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql, Mongo e Elasticsearch).

104 lines (100 loc) 3.02 kB
const { Model, DataTypes } = require("sequelize"); module.exports = Veiculos; async function Veiculos(sequelize) { class Veiculo extends Model {} Veiculo.init( { id: { primaryKey: true, autoIncrement: true, type: DataTypes.INTEGER, }, placa: { type: DataTypes.STRING(20), allowNull: false, unique: true, }, descricao: { type: DataTypes.STRING(100), allowNull: false, }, oleo: { type: DataTypes.INTEGER, allowNull: true, }, reastreador: { type: DataTypes.STRING(50), allowNull: true, }, tara: { type: DataTypes.DECIMAL(15, 2), allowNull: true, }, capacidade_kg: { type: DataTypes.DECIMAL(15, 2), allowNull: true, }, capacidade_m3: { type: DataTypes.DECIMAL(15, 2), allowNull: true, }, tipo_rodado: { type: DataTypes.ENUM("01", "02", "03", "04", "05", "06"), allowNull: true, }, tipo_carroceria: { type: DataTypes.ENUM("00", "01", "02", "03", "04", "05"), allowNull: true, }, uf_veiculo: { type: DataTypes.INTEGER, allowNull: true, }, latitude: { type: DataTypes.DECIMAL(10, 7), allowNull: true, }, longitude: { type: DataTypes.DECIMAL(10, 7), allowNull: true, }, lastupdate: { type: DataTypes.DATE, allowNull: true, }, id_filial: { type: DataTypes.INTEGER, allowNull: true, }, status: { type: DataTypes.ENUM("A", "I"), allowNull: true, defaultValue: "A", }, gps_time: { type: DataTypes.DATE, allowNull: true, }, data_aquisicao: { type: DataTypes.DATEONLY, allowNull: true, }, status_veiculos: { type: DataTypes.ENUM("on", "off"), allowNull: true, defaultValue: "off", }, ultima_atualizacao: { type: DataTypes.DATE, allowNull: false, }, }, { sequelize, timestamps: false, modelName: "veiculos", tableName: "veiculos", } ); return Veiculo; }