@@ -0,0 +1,14 @@
|
||||
-- Ejecutar una vez en la base existente del auth y del servicio Node.
|
||||
-- No crea ni reemplaza las tablas de negocio (activities, cases, client, etc.).
|
||||
BEGIN;
|
||||
CREATE TABLE IF NOT EXISTS activity_idempotency (
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
case_id INTEGER NOT NULL REFERENCES cases(id) ON DELETE CASCADE,
|
||||
key_hash CHAR(64) NOT NULL,
|
||||
fingerprint CHAR(64) NOT NULL,
|
||||
expires_at TIMESTAMPTZ NOT NULL,
|
||||
PRIMARY KEY(user_id,case_id,key_hash)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS activity_idempotency_expiry_idx ON activity_idempotency(expires_at);
|
||||
CREATE INDEX IF NOT EXISTS activities_case_status_paytype_idx ON activities(id_case,id_status,id_paytype);
|
||||
COMMIT;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Consulta de solo lectura: no cambia importes, tarifas ni marcas de pago.
|
||||
-- Revisar la factura o el registro original antes de completar estos datos.
|
||||
SELECT id, id_case, id_created, created, description, hours, rate, amount, payment,
|
||||
CASE WHEN payment IS TRUE THEN 'Requiere coste historico antes de recalcular'
|
||||
ELSE 'Pendiente: bloquea el reparto desde su posicion' END AS review_reason
|
||||
FROM activities
|
||||
WHERE id_paytype=1 AND id_status=5 AND amount IS NULL
|
||||
AND (hours IS NULL OR rate IS NULL)
|
||||
ORDER BY id_case, created, id;
|
||||
@@ -0,0 +1,33 @@
|
||||
param([switch]$Verify)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location -LiteralPath $projectRoot
|
||||
|
||||
if (Test-Path -LiteralPath '.env') {
|
||||
foreach ($line in [System.IO.File]::ReadAllLines((Join-Path $projectRoot '.env'), [System.Text.Encoding]::UTF8)) {
|
||||
if ($line -match '^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=(.*)$') {
|
||||
$settingName = $Matches[1]
|
||||
$settingValue = $Matches[2].Trim()
|
||||
if ($settingValue.Length -ge 2) {
|
||||
if (($settingValue.StartsWith('"') -and $settingValue.EndsWith('"')) -or
|
||||
($settingValue.StartsWith("'") -and $settingValue.EndsWith("'"))) {
|
||||
$settingValue = $settingValue.Substring(1, $settingValue.Length - 2)
|
||||
}
|
||||
}
|
||||
[Environment]::SetEnvironmentVariable($settingName, $settingValue, 'Process')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Write-Host 'No existe .env. Se usarán las variables del proceso; consulta .env.example.'
|
||||
}
|
||||
|
||||
if (!(Get-Command java -ErrorAction SilentlyContinue)) {
|
||||
if ($env:JAVA_HOME -and (Test-Path -LiteralPath (Join-Path $env:JAVA_HOME 'bin/java.exe'))) {
|
||||
$env:PATH = "$env:JAVA_HOME\bin;$env:PATH"
|
||||
} else {
|
||||
throw 'No se encuentra Java. Instala JDK 25 o configura JAVA_HOME.'
|
||||
}
|
||||
}
|
||||
if ($Verify) { & (Join-Path $projectRoot 'mvnw.cmd') verify }
|
||||
else { & (Join-Path $projectRoot 'mvnw.cmd') spring-boot:run }
|
||||
exit $LASTEXITCODE
|
||||
Reference in New Issue
Block a user