actualizando bd
All checks were successful
build-and-deploy / filter (push) Successful in 2s
build-and-deploy / build (push) Successful in 8s
build-and-deploy / deploy (push) Successful in 13s

This commit is contained in:
2025-05-14 20:09:01 -06:00
parent 1b05d739fc
commit ec40acf5b5
8 changed files with 131 additions and 39 deletions

View File

@@ -1,6 +1,9 @@
estructura:
powershell -ExecutionPolicy Bypass -File ./dev/scripts/estructura.ps1
testdb:
docker compose -f api/dev/docker-compose.yml up -d
build:
docker compose build

8
api/.env.example Normal file
View File

@@ -0,0 +1,8 @@
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
DATABASE_URL=postgresql://planilla:planilla@localhost:5434/planilla_db?schema=public

1
api/.gitignore vendored
View File

@@ -1,4 +1,5 @@
node_modules
dev
# Keep environment variables out of version control
.env
prisma/generated

View File

@@ -0,0 +1,84 @@
-- CreateTable
CREATE TABLE "Cliente" (
"id" BIGSERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"name" TEXT NOT NULL,
"cedula" BIGINT NOT NULL,
"ubicacion" TEXT NOT NULL DEFAULT '.',
"grupo_estudio" TEXT,
"empleado" BOOLEAN NOT NULL DEFAULT false,
"avatar_url" TEXT,
"telefono" TEXT,
"idciat" TEXT,
CONSTRAINT "Cliente_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Planilla" (
"id" BIGSERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"fecha_desde" TIMESTAMP(3) NOT NULL,
"fecha_hasta" TIMESTAMP(3) NOT NULL,
"titulo" TEXT NOT NULL,
"total" DECIMAL(65,30),
"estado" TEXT NOT NULL DEFAULT 'pagado',
"fecha_anulado" TIMESTAMP(3),
"empleado_id" BIGINT NOT NULL,
"creador_id" UUID,
"anulador_id" UUID,
CONSTRAINT "Planilla_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "TareaRealizada" (
"id" BIGSERIAL NOT NULL,
"empleado_id" BIGINT NOT NULL,
"planilla_id" BIGINT,
"titulo" TEXT NOT NULL,
"precio" DOUBLE PRECISION,
"estado" TEXT NOT NULL DEFAULT 'pendiente',
"observacion" TEXT,
"fecha" TIMESTAMP(3) NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"tipo" TEXT NOT NULL DEFAULT '',
"fecha_anulado" TIMESTAMP(3),
"creador_id" UUID NOT NULL,
"anulador_id" UUID,
CONSTRAINT "TareaRealizada_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Asistencia" (
"id" BIGSERIAL NOT NULL,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT (now() AT TIME ZONE 'utc'),
"entrada" TIMESTAMP(3) DEFAULT (now() AT TIME ZONE 'utc'),
"salida" TIMESTAMP(3),
"historial" JSONB,
"observacion" TEXT,
"estado" TEXT DEFAULT 'pendiente',
"fecha_anulado" TIMESTAMP(3),
"empleado_id" BIGINT NOT NULL,
"creador_id" UUID NOT NULL,
"modificado_id" UUID,
"anulador_id" UUID,
CONSTRAINT "Asistencia_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "Cliente_cedula_key" ON "Cliente"("cedula");
-- AddForeignKey
ALTER TABLE "Planilla" ADD CONSTRAINT "Planilla_empleado_id_fkey" FOREIGN KEY ("empleado_id") REFERENCES "Cliente"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "TareaRealizada" ADD CONSTRAINT "TareaRealizada_empleado_id_fkey" FOREIGN KEY ("empleado_id") REFERENCES "Cliente"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Asistencia" ADD CONSTRAINT "Asistencia_empleado_id_fkey" FOREIGN KEY ("empleado_id") REFERENCES "Cliente"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"

View File

@@ -6,13 +6,12 @@ generator client {
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Cliente {
id BigInt @id @default(autoincrement())
created_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
updated_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
created_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')"))
updated_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')")) @updatedAt
name String
cedula BigInt @unique
ubicacion String @default(".")
@@ -28,15 +27,15 @@ model Cliente {
}
model Planilla {
id BigInt @id @default(autoincrement())
created_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
updated_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
fecha_desde DateTime
fecha_hasta DateTime
titulo String
total Decimal?
estado String @default("pagado")
fecha_anulado DateTime?
id BigInt @id @default(autoincrement())
created_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')"))
updated_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')")) @updatedAt
fecha_desde DateTime
fecha_hasta DateTime
titulo String
total Decimal?
estado String @default("pagado")
fecha_anulado DateTime?
empleado_id BigInt
empleado Cliente @relation(fields: [empleado_id], references: [id])
@@ -54,7 +53,7 @@ model TareaRealizada {
estado String @default("pendiente")
observacion String?
fecha DateTime
created_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
created_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')"))
tipo String @default("")
fecha_anulado DateTime?
@@ -66,9 +65,9 @@ model TareaRealizada {
model Asistencia {
id BigInt @id @default(autoincrement())
created_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
updated_at DateTime @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
entrada DateTime? @default(dbgenerated("now() AT TIME ZONE 'utc'::text"))
created_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')"))
updated_at DateTime @default(dbgenerated("(now() AT TIME ZONE 'utc')")) @updatedAt
entrada DateTime? @default(dbgenerated("(now() AT TIME ZONE 'utc')"))
salida DateTime?
historial Json?
observacion String?

View File

@@ -1,10 +1,10 @@
version: "3.8"
services:
agent:
image: gitea.interno.com/nucleo000/planilla-agent:latest
build: ./agent
restart: unless-stopped
# volumes:
# - /srv/planilla/agent:/app
networks: [planilla]
api:
@@ -12,37 +12,29 @@ services:
build: ./api
restart: unless-stopped
environment:
- DATABASE_URL=postgresql://planilla:secret@db:5432/planilla_db
depends_on: [db]
ports: ["3009:4000"]
# volumes:
# - /srv/planilla/api:/app
DATABASE_URL: "postgresql://planilla:secret@db:5432/planilla_db?schema=public"
depends_on:
- db
ports:
- "3009:4000"
networks: [planilla]
# mcp (comentado aún, por si lo activás después)
# mcp:
# image: gitea.interno.com/nucleo000/planilla-mcp:latest
# build: ./mcp
# volumes:
# - /srv/planilla/mcp:/app
# networks: [planilla]
ui:
image: gitea.interno.com/nucleo000/planilla-ui:latest
build: ./ui
restart: unless-stopped
ports: ["3008:80"]
# volumes:
# - /srv/planilla/ui:/app
ports:
- "3008:80"
networks: [planilla]
worker:
image: gitea.interno.com/nucleo000/planilla-worker:latest
build: ./worker
depends_on: [db]
# volumes:
# - /srv/planilla/worker:/app
restart: unless-stopped
environment:
DATABASE_URL: "postgresql://planilla:secret@db:5432/planilla_db?schema=public"
depends_on:
- db
networks: [planilla]
db:
@@ -66,7 +58,7 @@ services:
- db
volumes:
- /srv/planilla/pgadmin:/var/lib/pgadmin
user: "5050:5050" # ✅ necesario para evitar error de permisos
user: "5050:5050"
networks: [planilla]
volumes:

View File

@@ -32,6 +32,7 @@ C:\no guardar\nucleo V3\planilla\agent\utils\decryptMediaContent.js
C:\no guardar\nucleo V3\planilla\agent\utils\processMessage.js
C:\no guardar\nucleo V3\planilla\agent\utils\saveMedia.js
C:\no guardar\nucleo V3\planilla\api\cron_jobs
C:\no guardar\nucleo V3\planilla\api\dev
C:\no guardar\nucleo V3\planilla\api\prisma
C:\no guardar\nucleo V3\planilla\api\.env
C:\no guardar\nucleo V3\planilla\api\Dockerfile
@@ -39,6 +40,7 @@ C:\no guardar\nucleo V3\planilla\api\entrypoint.sh
C:\no guardar\nucleo V3\planilla\api\package-lock.json
C:\no guardar\nucleo V3\planilla\api\package.json
C:\no guardar\nucleo V3\planilla\api\server.js
C:\no guardar\nucleo V3\planilla\api\dev\docker-compose.yml
C:\no guardar\nucleo V3\planilla\api\prisma\generated
C:\no guardar\nucleo V3\planilla\api\prisma\schema.prisma
C:\no guardar\nucleo V3\planilla\api\prisma\generated\client