refatoração

This commit is contained in:
Luiz H. R. Silva 2024-06-16 15:42:20 -03:00
parent 117bdbef7b
commit 8b8406e245
28 changed files with 300 additions and 51 deletions

View file

@ -9,16 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
import { respostaComuns } from "p-respostas";
import { z } from "zod";
import { PREFIXO } from "./_variaveis";
import { PREFIXO, baseUrlPilao } from "./_variaveis";
//enviar registros para base de dados
export const zp_enviar_registros = z.object({
tabela: z.string(),
registros: z.array(z.any()),
});
export const enviar_registros = ({ emDesenvolvimento, cliente: { conta, produto }, parametros: { registros, tabela }, }) => __awaiter(void 0, void 0, void 0, function* () {
const url = new URL(`${emDesenvolvimento
? "http://127.0.0.1:5080"
: "https://carro-de-boi.idz.one"}${PREFIXO}/enviar-registro/${produto}/${conta}`);
const url = new URL(`${baseUrlPilao(emDesenvolvimento)}${PREFIXO}/${Object.keys({ enviar_registros })[0]}/${produto}/${conta}`);
const tamanhoBlocos = 1000;
while (registros.length > 0) {
const bloco = registros.splice(0, tamanhoBlocos);