pdf: add new feature

Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2026-02-27 17:32:18 -03:00
1 parent a63aaeb655
commit 61a1631519
14 files changed
+3091 -1

No files matched your search

@@ -0,0 +1,35 @@
-- Migration para adicionar tabela de operações de PDF
-- Created: 2026-02-27
-- Criar ENUM para tipo de operação
CREATE TYPE "TipoOperacaoPDF" AS ENUM ('COMPRIMIR', 'DIVIDIR', 'MESCLAR', 'PDF_PARA_IMAGEM', 'IMAGEM_PARA_PDF', 'OCR');
-- Criar ENUM para status da operação
CREATE TYPE "StatusOperacaoPDF" AS ENUM ('PROCESSANDO', 'CONCLUIDO', 'ERRO');
-- Criar tabela de operações de PDF
CREATE TABLE "operacoes_pdf" (
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
"tipoOperacao" "TipoOperacaoPDF" NOT NULL,
"status" "StatusOperacaoPDF" NOT NULL DEFAULT 'PROCESSANDO',
"usuarioId" UUID NOT NULL,
"arquivosOriginais" TEXT[] NOT NULL,
"arquivosResultado" TEXT[] NOT NULL,
"tamanhoOriginal" BIGINT NOT NULL,
"tamanhoResultado" BIGINT,
"parametros" JSONB,
"mensagemErro" TEXT,
"detalhesOCR" JSONB,
"tempoProcessamento" INTEGER,
"criadoEm" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"atualizadoEm" TIMESTAMP(3) NOT NULL,
CONSTRAINT "operacoes_pdf_pkey" PRIMARY KEY ("id")
);
-- Adicionar foreign key para usuariosALTER TABLE "operacoes_pdf" ADD CONSTRAINT "operacoes_pdf_usuarioId_fkey" FOREIGN KEY ("usuarioId") REFERENCES "usuarios"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- Criar índice para melhor performance nas consultas
CREATE INDEX "operacoes_pdf_usuarioId_idx" ON "operacoes_pdf"("usuarioId");
CREATE INDEX "operacoes_pdf_criadoEm_idx" ON "operacoes_pdf"("criadoEm" DESC);
CREATE INDEX "operacoes_pdf_status_idx" ON "operacoes_pdf"("status");