giganet_conecta
Version:
Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql & Mongo).
981 lines (976 loc) • 23.9 kB
JavaScript
const { Model, DataTypes, fn } = require("sequelize");
module.exports = Clientes;
async function Clientes(sequelize) {
class Model_Clientes extends Model {}
Model_Clientes.init(
{
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
},
razao: {
type: DataTypes.STRING(200),
allowNull: false,
},
fantasia: {
type: DataTypes.STRING(200),
allowNull: true,
},
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,
references: {
model: "cidade",
key: "id",
},
},
uf: {
type: DataTypes.INTEGER,
allowNull: true,
},
cnpj_cpf: {
type: DataTypes.STRING(30),
allowNull: true,
},
ie_identidade: {
type: DataTypes.STRING(30),
allowNull: true,
},
cond_pagamento: {
type: DataTypes.INTEGER,
allowNull: false,
},
fone: {
type: DataTypes.STRING(20),
allowNull: true,
},
cep: {
type: DataTypes.STRING(20),
allowNull: true,
},
email: {
type: DataTypes.STRING(256),
allowNull: true,
},
tipo_pessoa: {
type: DataTypes.ENUM("J", "F", "E", "1", "2", "8"),
allowNull: true,
defaultValue: "F",
},
id_tipo_cliente: {
type: DataTypes.INTEGER,
allowNull: true,
},
ativo: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
},
id_conta: {
type: DataTypes.INTEGER,
allowNull: false,
},
status_internet: {
type: DataTypes.ENUM("N", "A", "D", "CM", "CA", "CE", "FA"),
allowNull: true,
defaultValue: "N",
},
bloqueio_automatico: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
},
aviso_atraso: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "S",
},
obs: {
type: DataTypes.TEXT,
allowNull: true,
},
dia_vencimento: {
type: DataTypes.INTEGER,
allowNull: true,
},
data: {
type: DataTypes.DATEONLY,
allowNull: true,
},
id_myauth: {
type: DataTypes.INTEGER,
allowNull: true,
comment: "informativo",
},
telefone_comercial: {
type: DataTypes.STRING(20),
allowNull: true,
},
telefone_celular: {
type: DataTypes.STRING(20),
allowNull: true,
},
referencia: {
type: DataTypes.STRING(200),
allowNull: true,
},
complemento: {
type: DataTypes.STRING(100),
allowNull: true,
},
ramal: {
type: DataTypes.STRING(20),
allowNull: true,
},
senha: {
type: DataTypes.STRING(100),
allowNull: true,
},
nao_bloquear_ate: {
type: DataTypes.DATEONLY,
allowNull: true,
},
nao_avisar_ate: {
type: DataTypes.DATEONLY,
allowNull: true,
},
id_vendedor: {
type: DataTypes.INTEGER,
allowNull: true,
},
isuf: {
type: DataTypes.STRING(9),
allowNull: true,
},
tipo_assinante: {
type: DataTypes.ENUM("1", "2", "3", "4", "5", "6"),
allowNull: true,
defaultValue: "3",
},
data_nascimento: {
type: DataTypes.DATEONLY,
allowNull: true,
},
contato: {
type: DataTypes.STRING(100),
allowNull: true,
},
hotsite_email: {
type: DataTypes.STRING(150),
allowNull: true,
},
hotsite_acesso: {
type: DataTypes.INTEGER,
allowNull: true,
},
estado_civil: {
type: DataTypes.ENUM("Casado", "Solteiro", "Divorciado", "Viúvo"),
allowNull: true,
},
filial_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
},
latitude: {
type: DataTypes.STRING(50),
allowNull: true,
},
longitude: {
type: DataTypes.STRING(50),
allowNull: true,
},
crm: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
id_candato_tipo: {
type: DataTypes.INTEGER,
allowNull: true,
},
tabela_preco: {
type: DataTypes.INTEGER,
allowNull: true,
},
rg_orgao_emissor: {
type: DataTypes.CHAR(20),
allowNull: true,
},
nacionalidade: {
type: DataTypes.STRING(30),
allowNull: true,
defaultValue: "Brasileiro",
},
deb_automatico: {
type: DataTypes.STRING(25),
allowNull: true,
},
deb_agencia: {
type: DataTypes.STRING(10),
allowNull: true,
},
deb_conta: {
type: DataTypes.STRING(20),
allowNull: true,
},
alerta: {
type: DataTypes.TEXT,
allowNull: true,
},
data_cadastro: {
type: DataTypes.DATEONLY,
allowNull: true,
},
endereco_cob: {
type: DataTypes.STRING(200),
allowNull: true,
},
numero_cob: {
type: DataTypes.STRING(20),
allowNull: true,
},
bairro_cob: {
type: DataTypes.STRING(100),
allowNull: true,
},
cidade_cob: {
type: DataTypes.INTEGER,
allowNull: true,
},
uf_cob: {
type: DataTypes.INTEGER,
allowNull: true,
},
cep_cob: {
type: DataTypes.STRING(20),
allowNull: true,
},
referencia_cob: {
type: DataTypes.STRING(200),
allowNull: true,
},
complemento_cob: {
type: DataTypes.STRING(100),
allowNull: true,
},
participa_cobranca: {
type: DataTypes.ENUM("S", "N", "P"),
allowNull: false,
defaultValue: "S",
},
num_dias_cob: {
type: DataTypes.INTEGER,
allowNull: true,
},
profissao: {
type: DataTypes.STRING(50),
allowNull: true,
},
url_site: {
type: DataTypes.TEXT,
allowNull: true,
},
url_sistema: {
type: DataTypes.TEXT,
allowNull: true,
},
ip_sistema: {
type: DataTypes.STRING(100),
allowNull: true,
},
porta_ssh_sistema: {
type: DataTypes.INTEGER,
allowNull: true,
},
senha_root_sistema: {
type: DataTypes.STRING(100),
allowNull: true,
},
remessa_debito: {
type: DataTypes.INTEGER,
allowNull: true,
},
id_operadora_celular: {
type: DataTypes.INTEGER,
allowNull: true,
},
participa_pre_cobranca: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "S",
},
cob_envia_email: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "S",
},
cob_envia_sms: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "S",
},
contribuinte_icms: {
type: DataTypes.ENUM("S", "N", "I"),
allowNull: false,
defaultValue: "N",
},
Sexo: {
type: DataTypes.ENUM("F", "M"),
allowNull: true,
},
id_condominio: {
type: DataTypes.INTEGER,
allowNull: true,
},
nome_pai: {
type: DataTypes.STRING(150),
allowNull: true,
},
nome_mae: {
type: DataTypes.STRING(150),
allowNull: true,
},
quantidade_dependentes: {
type: DataTypes.INTEGER,
allowNull: true,
},
nome_conjuge: {
type: DataTypes.STRING(150),
allowNull: true,
},
fone_conjuge: {
type: DataTypes.STRING(20),
allowNull: true,
},
cpf_conjuge: {
type: DataTypes.STRING(15),
allowNull: true,
},
rg_conjuge: {
type: DataTypes.STRING(20),
allowNull: true,
},
data_nascimento_conjuge: {
type: DataTypes.DATEONLY,
allowNull: true,
},
moradia: {
type: DataTypes.ENUM("P", "A"),
allowNull: true,
},
nome_contador: {
type: DataTypes.STRING(150),
allowNull: true,
},
telefone_contador: {
type: DataTypes.STRING(20),
allowNull: true,
},
ref_com_empresa1: {
type: DataTypes.STRING(150),
allowNull: true,
},
ref_com_empresa2: {
type: DataTypes.STRING(150),
allowNull: true,
},
ref_com_fone1: {
type: DataTypes.STRING(20),
allowNull: true,
},
ref_com_fone2: {
type: DataTypes.STRING(20),
allowNull: true,
},
ref_pes_nome1: {
type: DataTypes.STRING(100),
allowNull: true,
},
ref_pes_nome2: {
type: DataTypes.STRING(100),
allowNull: true,
},
ref_pes_fone1: {
type: DataTypes.STRING(20),
allowNull: true,
},
ref_pes_fone2: {
type: DataTypes.STRING(20),
allowNull: true,
},
emp_empresa: {
type: DataTypes.STRING(150),
allowNull: true,
},
emp_cnpj: {
type: DataTypes.STRING(20),
allowNull: true,
},
emp_cep: {
type: DataTypes.STRING(15),
allowNull: true,
},
emp_endereco: {
type: DataTypes.STRING(100),
allowNull: true,
},
emp_cidade: {
type: DataTypes.INTEGER,
allowNull: true,
},
emp_fone: {
type: DataTypes.STRING(20),
allowNull: true,
},
emp_contato: {
type: DataTypes.STRING(100),
allowNull: true,
},
emp_cargo: {
type: DataTypes.STRING(100),
allowNull: true,
},
emp_remuneracao: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
},
emp_data_admissao: {
type: DataTypes.DATEONLY,
allowNull: true,
},
website: {
type: DataTypes.STRING(200),
allowNull: true,
},
skype: {
type: DataTypes.STRING(100),
allowNull: true,
},
status_prospeccao: {
type: DataTypes.ENUM(
"C",
"S",
"A",
"N",
"V",
"P",
"AB",
"SV",
"SP",
"AC"
),
allowNull: true,
defaultValue: "C",
},
prospeccao_ultimo_contato: {
type: DataTypes.DATEONLY,
allowNull: true,
},
prospeccao_proximo_contato: {
type: DataTypes.DATEONLY,
allowNull: true,
},
orgao_publico: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
pipe_id_organizacao: {
type: DataTypes.INTEGER,
allowNull: true,
},
im: {
type: DataTypes.STRING(20),
allowNull: true,
},
responsavel: {
type: DataTypes.INTEGER,
allowNull: true,
},
bloco: {
type: DataTypes.STRING(100),
allowNull: true,
},
apartamento: {
type: DataTypes.STRING(11),
allowNull: true,
},
cif: {
type: DataTypes.STRING(12),
allowNull: true,
},
grau_satisfacao: {
type: DataTypes.ENUM("1", "2", "3", "4", "5"),
allowNull: true,
},
idx: {
type: DataTypes.INTEGER,
allowNull: true,
},
iss_classificacao: {
type: DataTypes.STRING(2),
allowNull: false,
defaultValue: "99",
},
iss_classificacao_padrao: {
type: DataTypes.STRING(2),
allowNull: false,
defaultValue: "99",
},
tipo_cliente_scm: {
type: DataTypes.ENUM(
"01",
"02",
"03",
"04",
"05",
"06",
"07",
"08",
"99",
"0-13",
"0-15",
"0-23",
"0-47",
"R-99-PN"
),
allowNull: true,
defaultValue: "01",
},
pis_retem: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
cofins_retem: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
csll_retem: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
irrf_retem: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
cpf_pai: {
type: DataTypes.STRING(30),
allowNull: true,
},
cpf_mae: {
type: DataTypes.STRING(30),
allowNull: true,
},
identidade_pai: {
type: DataTypes.STRING(30),
allowNull: true,
},
identidade_mae: {
type: DataTypes.STRING(30),
allowNull: true,
},
nascimento_pai: {
type: DataTypes.DATEONLY,
allowNull: true,
},
nascimento_mae: {
type: DataTypes.DATEONLY,
allowNull: true,
},
id_canal_venda: {
type: DataTypes.INTEGER,
allowNull: true,
},
whatsapp: {
type: DataTypes.STRING(20),
allowNull: true,
},
inscricao_municipal: {
type: DataTypes.STRING(30),
allowNull: true,
},
nome_representante_1: {
type: DataTypes.STRING(200),
allowNull: true,
},
nome_representante_2: {
type: DataTypes.STRING(200),
allowNull: true,
},
cpf_representante_1: {
type: DataTypes.STRING(30),
allowNull: true,
},
cpf_representante_2: {
type: DataTypes.STRING(30),
allowNull: true,
},
identidade_representante_1: {
type: DataTypes.STRING(30),
allowNull: true,
},
identidade_representante_2: {
type: DataTypes.STRING(30),
allowNull: true,
},
id_contato_principal: {
type: DataTypes.INTEGER,
allowNull: true,
},
id_concorrente: {
type: DataTypes.INTEGER,
allowNull: true,
},
id_perfil: {
type: DataTypes.INTEGER,
allowNull: true,
},
codigo_operacao: {
type: DataTypes.INTEGER,
allowNull: true,
},
convert_cliente_forn: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "N",
},
tipo_pessoa_titular_conta: {
type: DataTypes.ENUM("F", "J"),
allowNull: true,
defaultValue: "F",
},
cnpj_cpf_titular_conta: {
type: DataTypes.STRING(30),
allowNull: true,
},
crm_data_vencemos: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_perdemos: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_novo: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_sondagem: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_apresentando: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_negociando: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_abortamos: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_sem_porta_disponivel: {
type: DataTypes.DATEONLY,
allowNull: true,
},
crm_data_sem_viabilidade: {
type: DataTypes.DATEONLY,
allowNull: true,
},
cadastrado_no_galaxPay: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
atualizar_cadastro_galaxPay: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
id_galaxPay: {
type: DataTypes.INTEGER,
allowNull: false,
},
acesso_automatico_central: {
type: DataTypes.STRING(1),
allowNull: false,
defaultValue: "P",
},
primeiro_acesso_central: {
type: DataTypes.STRING(1),
allowNull: false,
defaultValue: "S",
},
ativo_serasa: {
type: DataTypes.INTEGER,
allowNull: true,
},
id_vd_contrato_desejado: {
type: DataTypes.INTEGER,
allowNull: true,
},
foto_cartao: {
type: DataTypes.BLOB,
allowNull: true,
},
ultima_atualizacao: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: fn("current_timestamp"),
},
permite_armazenar_cartoes: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
yapay_token_account: {
type: DataTypes.STRING(100),
allowNull: true,
},
cli_desconta_iss_retido_total: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "N",
},
tv_code: {
type: DataTypes.TEXT,
allowNull: true,
},
tv_access_token: {
type: DataTypes.TEXT,
allowNull: true,
},
tv_token_expires_in: {
type: DataTypes.DATE,
allowNull: true,
},
tv_refresh_token: {
type: DataTypes.TEXT,
allowNull: true,
},
cidade_naturalidade: {
type: DataTypes.INTEGER,
allowNull: true,
},
cadastrado_via_viabilidade: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
},
substatus_prospeccao: {
type: DataTypes.INTEGER,
allowNull: true,
},
tipo_localidade: {
type: DataTypes.ENUM("R", "U"),
allowNull: false,
defaultValue: "U",
},
qtd_pessoas_calc_vel: {
type: DataTypes.INTEGER,
allowNull: true,
},
qtd_smart_calc_vel: {
type: DataTypes.INTEGER,
allowNull: true,
},
qtd_celular_calc_vel: {
type: DataTypes.INTEGER,
allowNull: true,
},
qtd_computador_calc_vel: {
type: DataTypes.INTEGER,
allowNull: true,
},
qtd_console_calc_vel: {
type: DataTypes.INTEGER,
allowNull: true,
},
freq_pessoas_calc_vel: {
type: DataTypes.STRING(7),
allowNull: true,
},
freq_smart_calc_vel: {
type: DataTypes.STRING(7),
allowNull: true,
},
freq_celular_calc_vel: {
type: DataTypes.STRING(7),
allowNull: true,
},
freq_computador_calc_vel: {
type: DataTypes.STRING(7),
allowNull: true,
},
freq_console_calc_vel: {
type: DataTypes.STRING(7),
allowNull: true,
},
resultado_calc_vel: {
type: DataTypes.STRING(20),
allowNull: true,
},
tipo_cobranca_auto_viab: {
type: DataTypes.INTEGER,
allowNull: true,
},
plano_negociacao_auto_viab: {
type: DataTypes.INTEGER,
allowNull: true,
},
data_reserva_auto_viab: {
type: DataTypes.DATEONLY,
allowNull: true,
},
melhor_periodo_reserva_auto_viab: {
type: DataTypes.ENUM("M", "N", "T"),
allowNull: true,
},
facebook: {
type: DataTypes.STRING(250),
allowNull: true,
},
alterar_senha_primeiro_acesso: {
type: DataTypes.ENUM("S", "N", "P"),
allowNull: true,
defaultValue: "P",
},
hash_redefinir_senha: {
type: DataTypes.STRING(32),
allowNull: true,
},
data_hash_redefinir_senha: {
type: DataTypes.DATE,
allowNull: true,
},
senha_hotsite_md5: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "N",
},
operador_neutro: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true,
},
external_id: {
type: DataTypes.STRING(100),
allowNull: true,
},
external_system: {
type: DataTypes.STRING(50),
allowNull: true,
},
status_viabilidade: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
},
tipo_rede: {
type: DataTypes.ENUM("P", "N", "A"),
allowNull: true,
},
rede_ativacao: {
type: DataTypes.ENUM("P", "N"),
allowNull: true,
defaultValue: "P",
},
indicado_por: {
type: DataTypes.INTEGER,
allowNull: true,
},
numero_antigo: {
type: DataTypes.STRING(40),
allowNull: true,
},
numero_cob_antigo: {
type: DataTypes.STRING(40),
allowNull: true,
},
id_fornecedor_conversao: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
},
id_campanha: {
type: DataTypes.INTEGER,
allowNull: true,
},
desconto_irrf_valor_inferior: {
type: DataTypes.ENUM("S", "N"),
allowNull: false,
defaultValue: "S",
},
id_vindi: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true,
},
antigo_acesso_central: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "N",
},
filtra_filial: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "S",
},
tipo_documento_identificacao: {
type: DataTypes.ENUM(
"11",
"12",
"13",
"21",
"22",
"31",
"41",
"42",
"47",
"50",
"91",
"CI",
"RUC",
"NUIT"
),
allowNull: false,
defaultValue: "13",
},
regua_cobranca_wpp: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "S",
},
regua_cobranca_notificacao: {
type: DataTypes.ENUM("S", "N"),
allowNull: true,
defaultValue: "S",
},
regime_fiscal_col: {
type: DataTypes.ENUM("48", "49"),
allowNull: true,
},
},
{
sequelize,
timestamps: false,
modelName: "cliente",
tableName: "cliente",
}
);
return Model_Clientes;
}