82 lines
4.1 KiB
Bash
Executable File
82 lines
4.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
ROOT="${ROOT:-/var/www/dhv2.korexlabs.com}"
|
|
API_URL="${API_URL:-http://127.0.0.1:3101/api/v3}"
|
|
TMP_MIGRATION="/tmp/dhv2-d5316-accept-migration-$$.log"
|
|
TMP_SCHEMA="/tmp/dhv2-d5316-schema-$$.log"
|
|
trap 'rm -f "$TMP_MIGRATION" "$TMP_SCHEMA"' EXIT
|
|
cd "$ROOT"
|
|
|
|
echo "========== D5.3.16 · VERSIONES =========="
|
|
[[ "$(node -p "require('./api-v3/package.json').version")" == "0.19.3-16" ]]
|
|
[[ "$(node -p "require('./web-v2/package.json').version")" == "0.19.3-16" ]]
|
|
grep -Fq "API_PHASE = 'D5.3.16'" api-v3/src/version.ts
|
|
grep -Fq "APP_PHASE = 'Fase D5.3.16 · Planificación de verificaciones'" web-v2/src/config/version.ts
|
|
echo "API: 0.19.3-16"
|
|
echo "WEB: 0.19.3-16"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · DB Y MIGRACIONES =========="
|
|
[[ "$(docker inspect dhv2-db --format '{{.State.Health.Status}}')" == "healthy" ]]
|
|
docker compose exec -T db sh -lc 'pg_isready -U "$POSTGRES_USER" -d "$POSTGRES_DB"'
|
|
docker compose --profile tools run --rm migrate npm run migration:show 2>&1 | tee "$TMP_MIGRATION"
|
|
grep -Fq 'Pending migrations: no' "$TMP_MIGRATION"
|
|
docker compose exec -T db sh -lc 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB" -Atc "SELECT table_name FROM information_schema.tables WHERE table_schema='\''public'\'' AND table_name='\''inspection_finding_verification_visits'\''; SELECT code FROM permissions WHERE code='\''inspection_verifications.plan'\'';"' | tee "$TMP_SCHEMA"
|
|
grep -Fxq 'inspection_finding_verification_visits' "$TMP_SCHEMA"
|
|
grep -Fxq 'inspection_verifications.plan' "$TMP_SCHEMA"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · HEALTH =========="
|
|
HEALTH="$(curl -fsS "$API_URL/health")"
|
|
echo "$HEALTH"
|
|
grep -Fq '"version":"0.19.3-16"' <<<"$HEALTH"
|
|
grep -Fq '"phase":"D5.3.16"' <<<"$HEALTH"
|
|
grep -Fq '"database":"ok"' <<<"$HEALTH"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · DOS VENCIMIENTOS =========="
|
|
grep -Fq 'finding.company_response_received_on IS NOT NULL' api-v3/src/inspection-verifications/inspection-verifications.service.ts
|
|
grep -Fq 'finding.next_control_on IS NOT NULL' api-v3/src/inspection-verifications/inspection-verifications.service.ts
|
|
grep -Fq 'La fecha de verificación no es el vencimiento administrativo.' web-v2/src/pages/VerificationPlanningPage.tsx
|
|
echo "Seguimiento administrativo y planificación operativa separados: OK"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · PLANIFICACIÓN =========="
|
|
grep -Fq "@Controller('inspection-verifications')" api-v3/src/inspection-verifications/inspection-verifications.controller.ts
|
|
grep -Fq 'VERIFICATION_CONTEXT_MIXED' api-v3/src/inspection-verifications/inspection-verifications.service.ts
|
|
grep -Fq 'VERIFICATION_ALREADY_PLANNED' api-v3/src/inspection-verifications/inspection-verifications.service.ts
|
|
grep -Fq 'inspection_finding_verification_visits' api-v3/src/inspection-verifications/inspection-verifications.service.ts
|
|
grep -Fq 'path="/hallazgos/planificacion"' web-v2/src/app/App.tsx
|
|
grep -Fq 'Crear visita de verificación' web-v2/src/pages/VerificationPlanningPage.tsx
|
|
echo "Bandeja y creación trazable de visitas de verificación: OK"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · HIGIENE DE CÓDIGO =========="
|
|
if grep -RnhE --include='*.ts' --include='*.tsx' '^[[:space:]]*(//|/\*|\*)' api-v3/src web-v2/src; then
|
|
echo "ERROR: quedaron comentarios narrativos en código de producción"
|
|
exit 1
|
|
fi
|
|
if grep -nE '/\*|\*/' web-v2/src/styles.css; then
|
|
echo "ERROR: quedaron comentarios internos en estilos de producción"
|
|
exit 1
|
|
fi
|
|
echo "Código de producción preparado para revisión externa: OK"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · SEGURIDAD HEREDADA =========="
|
|
STRONG_BACKUP="$(find /root/DH_V2_BACKUPS -maxdepth 1 -type d -name 'INVENTARIO_A_REVISAR_*' -printf '%T@ %p\n' | sort -nr | head -n1 | cut -d' ' -f2-)"
|
|
[[ -n "$STRONG_BACKUP" && -s "$STRONG_BACKUP/BACKUP_OK.txt" ]]
|
|
grep -Fq 'INVENTARIO A REVISAR' "$STRONG_BACKUP/BACKUP_OK.txt"
|
|
echo "Backup fuerte de referencia: $STRONG_BACKUP"
|
|
|
|
echo
|
|
echo "========== D5.3.16 · CONTENEDORES =========="
|
|
docker compose ps -a
|
|
[[ "$(docker inspect dhv2-db --format '{{.State.Health.Status}}')" == "healthy" ]]
|
|
[[ "$(docker inspect dhv2-api --format '{{.State.Status}}')" == "running" ]]
|
|
[[ "$(docker inspect dhv2-web --format '{{.State.Status}}')" == "running" ]]
|
|
|
|
echo
|
|
echo "ACEPTACIÓN DE FASE D5.3.16: OK"
|