giganet_conecta
Version:
Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql & Mongo).
928 lines (753 loc) • 21.7 kB
JavaScript
const { Model, DataTypes, fn } = require("sequelize");
module.exports = Contratos
async function Contratos(sequelize) {
class Model_Contratos extends Model { }
Model_Contratos.init({
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
id_vd_contrato: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'vd_contratos',
key: 'id'
}
},
id_cliente: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'cliente',
key: 'id'
}
},
status: {
type: DataTypes.ENUM('A', 'I', 'P', 'N', 'D'),
allowNull: true,
defaultValue: "P"
},
data: {
type: DataTypes.DATEONLY,
allowNull: false
},
data_validade: {
type: DataTypes.DATEONLY,
allowNull: true
},
pago_ate_data: {
type: DataTypes.DATEONLY,
allowNull: true
},
renovacao_automatica: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "S"
},
valor_unitario: {
type: DataTypes.DECIMAL(15, 5),
allowNull: true
},
id_tipo_contrato: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'cliente_contrato_tipo',
key: 'id'
}
},
contrato: {
type: DataTypes.STRING(100),
allowNull: true
},
id_filial: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'filial',
key: 'id'
}
},
id_tipo_documento: {
type: DataTypes.INTEGER,
allowNull: true
},
id_carteira_cobranca: {
type: DataTypes.INTEGER,
allowNull: true
},
id_vendedor: {
type: DataTypes.INTEGER,
allowNull: true
},
comissao: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true
},
status_internet: {
type: DataTypes.ENUM('A', 'D', 'CM', 'CA', 'CE', 'FA', 'AA'),
allowNull: true,
defaultValue: "A"
},
bloqueio_automatico: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "S"
},
nao_bloquear_ate: {
type: DataTypes.DATEONLY,
allowNull: true
},
aviso_atraso: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "S"
},
nao_avisar_ate: {
type: DataTypes.DATEONLY,
allowNull: true
},
obs: {
type: DataTypes.TEXT,
allowNull: true
},
id_modelo: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
references: {
model: 'cliente_contrato_modelo',
key: 'id'
}
},
cc_previsao: {
type: DataTypes.ENUM('P', 'N', 'S', 'M'),
allowNull: false,
defaultValue: "P"
},
tipo_doc_opc: {
type: DataTypes.INTEGER,
allowNull: true
},
data_cancelamento: {
type: DataTypes.DATEONLY,
allowNull: true
},
data_validada: {
type: DataTypes.DATEONLY,
allowNull: true
},
taxa_instalacao: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
desconto_fidelidade: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
fidelidade: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 12
},
taxa_improdutiva: {
type: DataTypes.DECIMAL(15, 3),
allowNull: true
},
data_renovacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
tipo: {
type: DataTypes.ENUM('I', 'T', 'S', 'SVA'),
allowNull: false,
defaultValue: "I"
},
tel_franquia_segundos: {
type: DataTypes.INTEGER,
allowNull: true
},
tel_franquia_prefix: {
type: DataTypes.STRING(250),
allowNull: true
},
obs_cancelamento: {
type: DataTypes.TEXT,
allowNull: true
},
motivo_cancelamento: {
type: DataTypes.INTEGER,
allowNull: true
},
email_cobranca: {
type: DataTypes.STRING(250),
allowNull: true
},
tipo_cobranca: {
type: DataTypes.ENUM('P', 'I', 'E'),
allowNull: false,
defaultValue: "P"
},
lote: {
type: DataTypes.INTEGER,
allowNull: true
},
condicao_pagamento_primeira_fat: {
type: DataTypes.INTEGER,
allowNull: true
},
data_negativacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
protocolo_negativacao: {
type: DataTypes.STRING(50),
allowNull: true
},
desbloqueio_confianca: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: true,
defaultValue: "P"
},
desbloqueio_confianca_ativo: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
descricao_aux_plano_venda: {
type: DataTypes.STRING(200),
allowNull: true
},
avalista_1: {
type: DataTypes.INTEGER,
allowNull: true
},
avalista_2: {
type: DataTypes.INTEGER,
allowNull: true
},
rec_bandeira: {
type: DataTypes.STRING(12),
allowNull: true
},
rec_cartao: {
type: DataTypes.STRING(20),
allowNull: true
},
rec_token: {
type: DataTypes.STRING(80),
allowNull: true
},
data_ativacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
imp_importacao: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
imp_carteira: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
imp_rede: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
imp_bkp: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
imp_treinamento: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
imp_status: {
type: DataTypes.ENUM('F', 'A'),
allowNull: true
},
imp_obs: {
type: DataTypes.TEXT,
allowNull: true
},
imp_realizado: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
imp_motivo: {
type: DataTypes.STRING(250),
allowNull: true
},
imp_inicial: {
type: DataTypes.DATEONLY,
allowNull: true
},
imp_final: {
type: DataTypes.DATEONLY,
allowNull: true
},
ativacao_numero_parcelas: {
type: DataTypes.STRING(100),
allowNull: true
},
ativacao_vencimentos: {
type: DataTypes.STRING(150),
allowNull: true
},
ativacao_valor_parcela: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
id_tipo_doc_ativ: {
type: DataTypes.INTEGER,
allowNull: true
},
id_produto_ativ: {
type: DataTypes.INTEGER,
allowNull: true
},
id_cond_pag_ativ: {
type: DataTypes.INTEGER,
allowNull: true
},
id_vendedor_ativ: {
type: DataTypes.INTEGER,
allowNull: true
},
endereco_padrao_cliente: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "S"
},
endereco: {
type: DataTypes.STRING(200),
allowNull: true
},
numero: {
type: DataTypes.STRING(20),
allowNull: true
},
bairro: {
type: DataTypes.STRING(100),
allowNull: true
},
cidade: {
type: DataTypes.INTEGER,
allowNull: true
},
cep: {
type: DataTypes.STRING(20),
allowNull: true
},
complemento: {
type: DataTypes.STRING(200),
allowNull: true
},
referencia: {
type: DataTypes.STRING(200),
allowNull: true
},
id_condominio: {
type: DataTypes.INTEGER,
allowNull: true
},
nf_info_adicionais: {
type: DataTypes.STRING(1500),
allowNull: true
},
assinatura_digital: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: true,
defaultValue: "P"
},
tipo_produtos_plano: {
type: DataTypes.ENUM('P', 'PLA', 'PRO'),
allowNull: false,
defaultValue: "P"
},
status_velocidade: {
type: DataTypes.STRING(2),
allowNull: false,
defaultValue: "N"
},
bloco: {
type: DataTypes.STRING(100),
allowNull: true
},
apartamento: {
type: DataTypes.INTEGER,
allowNull: true
},
id_instalador: {
type: DataTypes.INTEGER,
allowNull: true
},
motivo_inclusao: {
type: DataTypes.ENUM('I', 'U', 'D', 'M', 'T', 'L', 'N', 'R'),
allowNull: false,
defaultValue: "I"
},
latitude: {
type: DataTypes.STRING(30),
allowNull: true
},
longitude: {
type: DataTypes.STRING(30),
allowNull: true
},
id_crm_negociacoes: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo_doc_opc2: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo_doc_opc3: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo_doc_opc4: {
type: DataTypes.INTEGER,
allowNull: true
},
liberacao_bloqueio_manual: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: false,
defaultValue: "P"
},
indicacao_contrato_id: {
type: DataTypes.INTEGER,
allowNull: false
},
num_parcelas_atraso: {
type: DataTypes.INTEGER,
allowNull: true
},
dt_ult_ativacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_inativacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_utl_negativacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_desb_conf: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_desativacao: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_bloq_manual: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_bloq_auto: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_finan_atraso: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_desiste: {
type: DataTypes.DATEONLY,
allowNull: true
},
id_contrato_principal: {
type: DataTypes.INTEGER,
allowNull: true
},
dt_ult_des_bloq_conf: {
type: DataTypes.DATEONLY,
allowNull: true
},
gerar_finan_assin_digital_contrato: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: true,
defaultValue: "P"
},
credit_card_recorrente_token: {
type: DataTypes.STRING(512),
allowNull: true
},
credit_card_recorrente_carteira_antiga: {
type: DataTypes.INTEGER,
allowNull: true
},
data_cadastro_sistema: {
type: DataTypes.DATEONLY,
allowNull: true
},
credit_card_recorrente_bandeira_cartao: {
type: DataTypes.STRING(10),
allowNull: true
},
credit_card_recorrente_dv_cartao: {
type: DataTypes.STRING(4),
allowNull: true
},
id_responsavel: {
type: DataTypes.INTEGER,
allowNull: true
},
ultima_atualizacao: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: fn('current_timestamp')
},
id_motivo_negativacao: {
type: DataTypes.INTEGER,
allowNull: true
},
obs_negativacao: {
type: DataTypes.TEXT,
allowNull: true
},
data_acesso_desativado: {
type: DataTypes.DATEONLY,
allowNull: true
},
restricao_auto_desbloqueio: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
motivo_restricao_auto_desbloq: {
type: DataTypes.TEXT,
allowNull: true
},
ativo_summit: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
portabilidade_summit: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
inicio_vigencia_summit: {
type: DataTypes.DATEONLY,
allowNull: true
},
fim_vigencia_summit: {
type: DataTypes.DATEONLY,
allowNull: true
},
range_inicial_summit: {
type: DataTypes.STRING(15),
allowNull: true
},
range_final_summit: {
type: DataTypes.STRING(15),
allowNull: true
},
dt_ult_liberacao_susp_parc: {
type: DataTypes.DATEONLY,
allowNull: true
},
nao_susp_parc_ate: {
type: DataTypes.DATEONLY,
allowNull: true
},
liberacao_suspensao_parcial: {
type: DataTypes.ENUM('H', 'D', 'P'),
allowNull: true,
defaultValue: "P"
},
utilizando_auto_libera_susp_parc: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
restricao_auto_libera_susp_parcial: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
motivo_restri_auto_libera_parc: {
type: DataTypes.TEXT,
allowNull: true
},
id_indexador_reajuste: {
type: DataTypes.INTEGER,
allowNull: true
},
id_cidade: {
type: DataTypes.TEXT,
allowNull: false
},
data_inicial_suspensao: {
type: DataTypes.DATEONLY,
allowNull: true
},
data_final_suspensao: {
type: DataTypes.DATEONLY,
allowNull: true
},
contrato_suspenso: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
data_retomada_contrato: {
type: DataTypes.DATEONLY,
allowNull: true
},
dt_ult_liberacao_temporaria: {
type: DataTypes.DATEONLY,
allowNull: true
},
updated_responsible_seller: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
data_desistencia: {
type: DataTypes.DATEONLY,
allowNull: true
},
motivo_desistencia: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
obs_desistencia: {
type: DataTypes.TEXT,
allowNull: true
},
obs_contrato: {
type: DataTypes.TEXT,
allowNull: true
},
alerta_contrato: {
type: DataTypes.TEXT,
allowNull: true
},
data_expiracao: {
type: DataTypes.DATEONLY,
allowNull: false
},
numero_antigo: {
type: DataTypes.STRING(40),
allowNull: true
},
base_geracao_tipo_doc: {
type: DataTypes.ENUM('OPC', 'PROD', 'P'),
allowNull: true,
defaultValue: "P"
},
integracao_assinatura_digital: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: true,
defaultValue: "P"
},
token_assinatura_digital: {
type: DataTypes.STRING(50),
allowNull: true
},
url_assinatura_digital: {
type: DataTypes.STRING(250),
allowNull: true
},
moeda: {
type: DataTypes.STRING(5),
allowNull: true
},
testemunha_assinatura_digital: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
selfie_photo: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: false,
defaultValue: "P"
},
document_photo: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: false,
defaultValue: "P"
},
id_vindi: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
data_assinatura: {
type: DataTypes.DATEONLY,
allowNull: true
},
ids_contratos_recorrencia: {
type: DataTypes.TEXT,
allowNull: true
},
motivo_adicional: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
concorrente_mot_adicional: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
id_responsavel_desistencia: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
id_responsavel_cancelamento: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
id_responsavel_negativacao: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
chave_pix: {
type: DataTypes.STRING(120),
allowNull: true
},
tipo_localidade: {
type: DataTypes.ENUM('R', 'U'),
allowNull: false,
defaultValue: "U"
},
isentar_contrato: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
financeiro_migrado: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
id_notifica_massa: {
type: DataTypes.INTEGER,
allowNull: true
},
estrato_social_col: {
type: DataTypes.ENUM('1', '2', '3', '4', '5', '6'),
allowNull: true
}
}, {
sequelize,
timestamps: false,
modelName: "cliente_contrato",
tableName: "cliente_contrato",
})
return Model_Contratos
}