giganet_conecta
Version:
Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql & Mongo).
738 lines (731 loc) • 21.1 kB
JavaScript
const { Model, DataTypes, fn } = require("sequelize");
module.exports = Produtos
async function Produtos(sequelize) {
class Model_Produtos extends Model { }
Model_Produtos.init({
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
descricao: {
type: DataTypes.STRING(200),
allowNull: true
},
codigo: {
type: DataTypes.STRING(50),
allowNull: true
},
ncm: {
type: DataTypes.STRING(50),
allowNull: false
},
unidade: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'unidades',
key: 'id'
}
},
valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
id_sub_grupo: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'sub_grupo_produdos',
key: 'id'
}
},
controla_estoque: {
type: DataTypes.ENUM('N', 'S', 'L'),
allowNull: false
},
qtde_tecido_base: {
type: DataTypes.DECIMAL(15, 9),
allowNull: false
},
qtde_tecido_almofadas: {
type: DataTypes.DECIMAL(15, 9),
allowNull: false
},
codigo_tecido: {
type: DataTypes.INTEGER,
allowNull: false
},
qtde_min: {
type: DataTypes.DECIMAL(15, 9),
allowNull: false
},
qtde_max: {
type: DataTypes.DECIMAL(15, 9),
allowNull: false
},
ativo: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false
},
id_conta_estoque: {
type: DataTypes.INTEGER,
allowNull: false
},
id_conta_despesa: {
type: DataTypes.INTEGER,
allowNull: false
},
id_conta_receita: {
type: DataTypes.INTEGER,
allowNull: false
},
data_inventario: {
type: DataTypes.DATEONLY,
allowNull: true
},
qtde_inventario: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true
},
qtde_entrada: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true
},
qtde_saida: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true
},
saldo: {
type: DataTypes.DECIMAL(18, 9),
allowNull: true
},
custo_medio: {
type: DataTypes.DECIMAL(15, 6),
allowNull: true
},
ultima_qtde_entrada: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true
},
ultima_qtde_saida: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true
},
movimentacao: {
type: DataTypes.ENUM('C', 'V', 'A'),
allowNull: true
},
tipo: {
type: DataTypes.ENUM('C', 'S', 'F', 'M', 'P', 'O'),
allowNull: true
},
descricao_alt: {
type: DataTypes.STRING(500),
allowNull: true
},
id_class_fiscal: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'cnf_classificacao_tributaria',
key: 'id'
}
},
preco_base: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
pcomissao: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true
},
icms_issqn: {
type: DataTypes.ENUM('ICMS', 'ISSQN'),
allowNull: false,
defaultValue: "ICMS"
},
pesob: {
type: DataTypes.DECIMAL(15, 3),
allowNull: true,
defaultValue: 0.000
},
pesol: {
type: DataTypes.DECIMAL(15, 3),
allowNull: true,
defaultValue: 0.000
},
data_ultima_compra: {
type: DataTypes.DATEONLY,
allowNull: true
},
margem_lucro: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_custo: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
custo_estoque: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
custo_medio_total: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
ecommerce: {
type: DataTypes.ENUM('S', 'N', 'P'),
allowNull: true,
defaultValue: "P"
},
descricao_completa: {
type: DataTypes.TEXT,
allowNull: true
},
checkbox1: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox2: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox3: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox4: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox5: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox6: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox7: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox8: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox9: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox10: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox11: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox12: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox13: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox14: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox15: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox16: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox17: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox18: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox19: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox20: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox21: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox22: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox23: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox24: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox25: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox26: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox27: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox28: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox29: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox30: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox31: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox32: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox33: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox34: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox35: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
subgrupo_tipo: {
type: DataTypes.STRING(10),
allowNull: true
},
id_tabela_fipe: {
type: DataTypes.INTEGER,
allowNull: true
},
chassi: {
type: DataTypes.STRING(50),
allowNull: true
},
renavan: {
type: DataTypes.STRING(15),
allowNull: true
},
km: {
type: DataTypes.INTEGER,
allowNull: true
},
cambio: {
type: DataTypes.TINYINT,
allowNull: true
},
qtdportas: {
type: DataTypes.SMALLINT,
allowNull: true
},
veiculo_cor: {
type: DataTypes.STRING(100),
allowNull: true
},
veiculo_combustivel: {
type: DataTypes.STRING(100),
allowNull: true
},
checkbox36: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox37: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox38: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox39: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
checkbox40: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
altura: {
type: DataTypes.DECIMAL(10, 1),
allowNull: true
},
largura: {
type: DataTypes.DECIMAL(10, 1),
allowNull: true
},
profundidade: {
type: DataTypes.DECIMAL(10, 1),
allowNull: true
},
imagem: {
type: DataTypes.STRING(300),
allowNull: true
},
ecommerce_prioridade: {
type: DataTypes.SMALLINT,
allowNull: true,
defaultValue: 1
},
ecommerce_pg_inicial: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "S"
},
aceita_valor: {
type: DataTypes.ENUM('P', 'N'),
allowNull: false,
defaultValue: "P"
},
vICMSSTRet: {
type: DataTypes.DECIMAL(10, 2),
allowNull: true
},
valor_prefixo: {
type: DataTypes.STRING(30),
allowNull: false,
defaultValue: "por"
},
valor_sufixo: {
type: DataTypes.STRING(30),
allowNull: true
},
tipo_ecommerce: {
type: DataTypes.STRING(2),
allowNull: true,
defaultValue: "X"
},
mostra_valor_ecommerce: {
type: DataTypes.STRING(1),
allowNull: true,
defaultValue: "0"
},
cod_servico: {
type: DataTypes.STRING(9),
allowNull: true
},
codigo_barras: {
type: DataTypes.STRING(100),
allowNull: true
},
id_produtos_ncm_cest: {
type: DataTypes.STRING(20),
allowNull: true
},
iss_natureza_operacao: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 1
},
vencimento_garantia: {
type: DataTypes.DATE,
allowNull: true
},
id_categoria_patrimonio: {
type: DataTypes.INTEGER,
allowNull: true
},
id_classe_financeira: {
type: DataTypes.INTEGER,
allowNull: true
},
id_conta_comodato: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_id_plataforma: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_id_pacote_canais: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_id_pacote_servicos: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_id_servicos: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_standalone: {
type: DataTypes.STRING(1),
allowNull: true
},
tv_id_canais: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_data_inicial: {
type: DataTypes.DATE,
allowNull: true
},
tv_data_final: {
type: DataTypes.DATE,
allowNull: true
},
tv_LineUp: {
type: DataTypes.INTEGER,
allowNull: true
},
plataforma: {
type: DataTypes.STRING(15),
allowNull: true
},
tv_id_pacote_servicos_watch: {
type: DataTypes.INTEGER,
allowNull: true
},
total_tickets_watch: {
type: DataTypes.INTEGER,
allowNull: true
},
descricao_pacote_watch: {
type: DataTypes.STRING(300),
allowNull: true
},
controle_impressao_etiqueta: {
type: DataTypes.INTEGER,
allowNull: true
},
id_class_fiscal_entrada: {
type: DataTypes.INTEGER,
allowNull: true
},
ultima_atualizacao: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: fn('current_timestamp')
},
tv_id_pacotes: {
type: DataTypes.STRING(50),
allowNull: true
},
tv_mus_produtos_disponiveis: {
type: "SET('MUMO','PARAMOUNTPLUS','NOGGIN','BEBANCA','BEGAMER','TOCALIVROS:CURADORIA','TOCALIVROS:AUDIOBOOK','HUBE','KASPERSKY:INTERNETSECURITY','KASPERSKY:PASSWORDMANAGER','KASPERSKY:TOTALSECURITY','CARTOON','EIPLUS','HBO:PAYTV','HBO:BB','DESCOMPLICA:ENEM','MONETOLAB:QUADRINHOS','MONETOLAB:REVISTAS','QUALIFICA:PRO','BITTRAINERS','VERISOFT:BANCAH','BEBANCA:REVISTAS','BEBANCA:PREMIUM','BIBLIOTECHIE','VERISOFT:LIVROH','VERISOFT:MINUTOCARREIRA','KASPERSKY:COMBO1','KASPERSKY:SAFEKIDS','TNTSTADIO','GRAVIOLADIGITAL:MDC','GRAVIOLADIGITAL:COV','GRAVIOLADIGITAL:MINICOV','PARTIU','MEDIQUO','KASPERSKY:STANDARD1','KASPERSKY:STANDARD3','KASPERSKY:STANDARD5','KASPERSKY:STANDARDPLUS3')",
allowNull: true
},
id_integracao_tv: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_id_pacote_temporario: {
type: DataTypes.INTEGER,
allowNull: true
},
tv_data_expiracao_pacote_temporario: {
type: DataTypes.DATEONLY,
allowNull: true
},
tv_dias_expiracao_pacote_temporario: {
type: DataTypes.INTEGER,
allowNull: true
},
id_plano_mvno: {
type: DataTypes.INTEGER,
allowNull: true
},
produto_playhub: {
type: DataTypes.STRING(15),
allowNull: true
},
id_sva_integracao: {
type: DataTypes.INTEGER,
allowNull: true
},
id_sva_pacote: {
type: DataTypes.STRING(200),
allowNull: true
},
id_sva_pacote_adicional: {
type: DataTypes.STRING(250),
allowNull: false
},
id_tipo_documento_servico: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0
},
id_fr_faturamento_classificacoes: {
type: DataTypes.INTEGER,
allowNull: true
},
tariff_plan: {
type: DataTypes.STRING(100),
allowNull: true
},
link: {
type: DataTypes.STRING(150),
allowNull: true
},
id_assinatura_integracao: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0
},
plataforma_integracao: {
type: DataTypes.STRING(45),
allowNull: true
},
tv_dtvgo_produtos_disponiveis: {
type: "SET('DTVGOBR','HBOBR','COMBATEBR','TELECINEBR','ESPNBR','CONMEBOLBR','PREMIEREBR','BBBBR','STARZBR')",
allowNull: true
},
tipo_produto_integracao: {
type: DataTypes.ENUM('A', 'C'),
allowNull: false,
defaultValue: "C"
},
tv_id_pacotes_adicionais: {
type: DataTypes.STRING(100),
allowNull: true,
defaultValue: "NULL"
},
integrador: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
limite_pacote: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
valor_adicional_pacote: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
cod_classificacao_servico: {
type: DataTypes.STRING(30),
allowNull: false
},
id_integracao_iot: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
id_produto_iot: {
type: DataTypes.STRING(120),
allowNull: true
}
}, {
sequelize,
tableName: 'produtos',
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "id" },
]
},
{
name: "unidade",
using: "BTREE",
fields: [
{ name: "unidade" },
]
},
{
name: "id_sub_grupo",
using: "BTREE",
fields: [
{ name: "id_sub_grupo" },
]
},
{
name: "id_class_fiscal",
using: "BTREE",
fields: [
{ name: "id_class_fiscal" },
]
},
{
name: "id_conta_estoque",
using: "BTREE",
fields: [
{ name: "id_conta_estoque" },
]
},
{
name: "id_conta_despesa",
using: "BTREE",
fields: [
{ name: "id_conta_despesa" },
]
},
{
name: "id_conta_receita",
using: "BTREE",
fields: [
{ name: "id_conta_receita" },
]
},
{
name: "id_categoria_patrimonio",
using: "BTREE",
fields: [
{ name: "id_categoria_patrimonio" },
]
},
{
name: "id_classe_financeira",
using: "BTREE",
fields: [
{ name: "id_classe_financeira" },
]
},
{
name: "id_tabela_fipe",
using: "BTREE",
fields: [
{ name: "id_tabela_fipe" },
]
},
{
name: "ultima_atualizacao",
using: "BTREE",
fields: [
{ name: "ultima_atualizacao" },
]
},
]
})
return Model_Produtos
}