giganet_conecta
Version:
Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql & Mongo).
445 lines (438 loc) • 11.8 kB
JavaScript
const { Model, DataTypes, fn } = require("sequelize");
module.exports = Os
async function Os(sequelize) {
class Model_Os extends Model { }
Model_Os.init({
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
id_cliente: {
type: DataTypes.INTEGER,
allowNull: true
},
id_login: {
type: DataTypes.INTEGER,
allowNull: true
},
prioridade: {
type: DataTypes.ENUM('B', 'N', 'A', 'C'),
allowNull: false
},
id_assunto: {
type: DataTypes.INTEGER,
allowNull: false
},
mensagem: {
type: DataTypes.STRING(3500),
allowNull: true
},
data_abertura: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: fn('current_timestamp')
},
data_agenda: {
type: DataTypes.DATE,
allowNull: true
},
id_tecnico: {
type: DataTypes.INTEGER,
allowNull: true
},
mensagem_resposta: {
type: DataTypes.STRING(3500),
allowNull: true
},
status: {
type: DataTypes.ENUM('A', 'F', 'AN', 'EN', 'AS', 'AG', 'EX', 'RAG', 'DS'),
allowNull: false,
defaultValue: "A"
},
id_filial: {
type: DataTypes.INTEGER,
allowNull: true
},
id_atendente: {
type: DataTypes.STRING(150),
allowNull: true
},
data_fechamento: {
type: DataTypes.DATE,
allowNull: true
},
setor: {
type: DataTypes.INTEGER,
allowNull: true
},
data_inicio: {
type: DataTypes.DATE,
allowNull: true
},
protocolo: {
type: DataTypes.STRING(50),
allowNull: true
},
data_reabertura: {
type: DataTypes.DATE,
allowNull: true
},
motivo_reabertura: {
type: DataTypes.STRING(500),
allowNull: true
},
id_usuario_reabertura: {
type: DataTypes.INTEGER,
allowNull: true
},
data_final: {
type: DataTypes.DATE,
allowNull: true
},
impresso: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
id_ticket: {
type: DataTypes.INTEGER,
allowNull: true
},
id_cobranca: {
type: DataTypes.INTEGER,
allowNull: true
},
id_oss_chamado: {
type: DataTypes.INTEGER,
allowNull: true
},
data_hora_analise: {
type: DataTypes.DATE,
allowNull: true
},
data_hora_encaminhado: {
type: DataTypes.DATE,
allowNull: true
},
data_hora_assumido: {
type: DataTypes.DATE,
allowNull: true
},
data_hora_execucao: {
type: DataTypes.DATE,
allowNull: true
},
id_wfl_param_os: {
type: DataTypes.INTEGER,
allowNull: true
},
id_wfl_tarefa: {
type: DataTypes.INTEGER,
allowNull: true
},
valor_total: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_outras_despesas: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_total_comissao: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00
},
id_contrato_kit: {
type: DataTypes.INTEGER,
allowNull: true
},
gera_comissao: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "S"
},
valor_unit_comissao: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00
},
melhor_horario_agenda: {
type: DataTypes.ENUM('M', 'T', 'N', 'Q'),
allowNull: true,
defaultValue: "Q"
},
idx: {
type: DataTypes.INTEGER,
allowNull: true
},
id_resposta: {
type: DataTypes.INTEGER,
allowNull: true
},
latitude: {
type: DataTypes.STRING(50),
allowNull: true
},
longitude: {
type: DataTypes.STRING(50),
allowNull: true
},
preview: {
type: DataTypes.TEXT,
allowNull: true
},
origem_endereco: {
type: DataTypes.ENUM('C', 'L', 'CC', 'M'),
allowNull: true
},
endereco: {
type: DataTypes.STRING(150),
allowNull: true
},
justificativa_sla_atrasado: {
type: DataTypes.TEXT,
allowNull: true
},
id_receber: {
type: DataTypes.BIGINT,
allowNull: true,
defaultValue: 0
},
id_circuito: {
type: DataTypes.INTEGER,
allowNull: true
},
id_su_diagnostico: {
type: DataTypes.INTEGER,
allowNull: true
},
id_cidade: {
type: DataTypes.INTEGER,
allowNull: true
},
mostrar_os_sem_funcionario: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "S"
},
bairro: {
type: DataTypes.STRING(100),
allowNull: true
},
id_estrutura: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo: {
type: DataTypes.ENUM('C', 'E'),
allowNull: false,
defaultValue: "C"
},
origem_endereco_estrutura: {
type: DataTypes.ENUM('E', 'M'),
allowNull: true,
defaultValue: "E"
},
liberado: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
},
data_agenda_final: {
type: DataTypes.DATE,
allowNull: true
},
data_prazo_limite: {
type: DataTypes.DATE,
allowNull: true
},
data_reservada: {
type: DataTypes.DATEONLY,
allowNull: true
},
data_reagendar: {
type: DataTypes.DATE,
allowNull: true
},
data_prev_final: {
type: DataTypes.DATE,
allowNull: true
},
origem_cadastro: {
type: DataTypes.ENUM('P', 'SV'),
allowNull: false,
defaultValue: "P"
},
status_sla: {
type: DataTypes.STRING(1),
allowNull: true
},
complemento: {
type: DataTypes.STRING(100),
allowNull: true
},
referencia: {
type: DataTypes.STRING(100),
allowNull: true
},
bloco: {
type: DataTypes.STRING(100),
allowNull: true
},
apartamento: {
type: DataTypes.STRING(100),
allowNull: true
},
ultima_atualizacao: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: fn('current_timestamp')
},
id_condominio: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
origem_finalizacao: {
type: DataTypes.ENUM('SM'),
allowNull: true
}
}, {
sequelize,
tableName: 'su_oss_chamado',
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "id" },
]
},
{
name: "id_login",
using: "BTREE",
fields: [
{ name: "id_login" },
]
},
{
name: "id_assunto",
using: "BTREE",
fields: [
{ name: "id_assunto" },
]
},
{
name: "id_tecnico",
using: "BTREE",
fields: [
{ name: "id_tecnico" },
]
},
{
name: "id_su_diagnostico",
using: "BTREE",
fields: [
{ name: "id_su_diagnostico" },
]
},
{
name: "id_cidade",
using: "BTREE",
fields: [
{ name: "id_cidade" },
]
},
{
name: "id_atendente",
using: "BTREE",
fields: [
{ name: "id_atendente" },
]
},
{
name: "id_ticket",
using: "BTREE",
fields: [
{ name: "id_ticket" },
]
},
{
name: "id_wfl_param_os",
using: "BTREE",
fields: [
{ name: "id_wfl_param_os" },
]
},
{
name: "id_wfl_tarefa",
using: "BTREE",
fields: [
{ name: "id_wfl_tarefa" },
]
},
{
name: "id_contrato_kit",
using: "BTREE",
fields: [
{ name: "id_contrato_kit" },
]
},
{
name: "id_cliente_2",
using: "BTREE",
fields: [
{ name: "id_cliente" },
]
},
{
name: "status",
using: "BTREE",
fields: [
{ name: "status" },
]
},
{
name: "ultima_atualizacao",
using: "BTREE",
fields: [
{ name: "ultima_atualizacao" },
]
},
{
name: "id_cobranca",
using: "BTREE",
fields: [
{ name: "id_cobranca" },
]
},
{
name: "id_filial",
using: "BTREE",
fields: [
{ name: "id_filial" },
]
},
{
name: "id_estrutura",
using: "BTREE",
fields: [
{ name: "id_estrutura" },
]
},
{
name: "protocolo",
using: "BTREE",
fields: [
{ name: "protocolo" },
]
},
]
}
)
return Model_Os
}