chore: Bump version to 1.0.3 and enhance update handling in the desktop application. Introduce release date stamping before build, add version listing functionality, and improve update prompts with detailed version information. Update README and scripts for clarity on release date management and version publishing.
This commit is contained in:
@@ -17,7 +17,7 @@ except ImportError:
|
||||
|
||||
from fastapi import BackgroundTasks, FastAPI, File, Form, HTTPException, UploadFile
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy import delete, select
|
||||
|
||||
from api.desktop_ingest import mark_task_completed_if_done, process_desktop_ingest
|
||||
|
||||
@@ -28,6 +28,8 @@ from domain.estimator import Estimator
|
||||
from domain.service import InvoiceProcessingService
|
||||
from domain.strategies import OpenAICompatibleExtractor
|
||||
from infrastructure.database import (
|
||||
CleanedRow,
|
||||
CleaningJob,
|
||||
CountJobFile,
|
||||
ExtractionBatch,
|
||||
ExtractionRow,
|
||||
@@ -1044,6 +1046,53 @@ def get_job_tasks(job_id: str) -> list[dict[str, Any]]:
|
||||
return [serialize_task(t) for t in tasks]
|
||||
|
||||
|
||||
@app.delete("/jobs/{job_id}", status_code=204)
|
||||
def delete_job(job_id: str) -> None:
|
||||
"""Elimina un job y todos sus resultados (tasks, conteos, extracciones, limpiezas)."""
|
||||
with session_scope() as session:
|
||||
job = session.get(Job, job_id)
|
||||
if job is None:
|
||||
raise HTTPException(status_code=404, detail="Job no encontrado")
|
||||
|
||||
tasks = session.scalars(select(Task).where(Task.job_id == job_id)).all()
|
||||
task_ids = [t.id for t in tasks]
|
||||
|
||||
batch_ids: list[str] = []
|
||||
if task_ids:
|
||||
batch_ids = list(
|
||||
session.scalars(
|
||||
select(ExtractionBatch.id).where(ExtractionBatch.job_module_id.in_(task_ids))
|
||||
).all()
|
||||
)
|
||||
|
||||
cleaning_ids = list(
|
||||
session.scalars(select(CleaningJob.id).where(CleaningJob.job_id == job_id)).all()
|
||||
)
|
||||
if batch_ids:
|
||||
cleaning_ids.extend(
|
||||
session.scalars(
|
||||
select(CleaningJob.id).where(CleaningJob.extraction_batch_id.in_(batch_ids))
|
||||
).all()
|
||||
)
|
||||
cleaning_ids = list(dict.fromkeys(cleaning_ids))
|
||||
|
||||
if cleaning_ids:
|
||||
session.execute(delete(CleanedRow).where(CleanedRow.cleaning_job_id.in_(cleaning_ids)))
|
||||
session.execute(delete(CleaningJob).where(CleaningJob.id.in_(cleaning_ids)))
|
||||
|
||||
if batch_ids:
|
||||
session.execute(delete(CleanedRow).where(CleanedRow.extraction_batch_id.in_(batch_ids)))
|
||||
session.execute(delete(ExtractionRow).where(ExtractionRow.batch_id.in_(batch_ids)))
|
||||
session.execute(delete(ExtractionBatch).where(ExtractionBatch.id.in_(batch_ids)))
|
||||
|
||||
if task_ids:
|
||||
session.execute(delete(CountJobFile).where(CountJobFile.job_module_id.in_(task_ids)))
|
||||
session.execute(delete(Task).where(Task.id.in_(task_ids)))
|
||||
|
||||
session.delete(job)
|
||||
session.flush()
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# Count Jobs — persistir y gestionar resultados del servicio de conteo
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user