diff --git a/.gitignore b/.gitignore index 3ec2352..4d1a8b6 100644 --- a/.gitignore +++ b/.gitignore @@ -169,3 +169,7 @@ whisperbox-transcribe.sqlite* # ruff .ruff_cache + +# other private files +/data +.env.prod diff --git a/Makefile b/Makefile index 8180bf1..b65dd96 100644 --- a/Makefile +++ b/Makefile @@ -18,8 +18,8 @@ test: pytest run: - docker compose -f docker-compose.base.yml -f docker-compose.prod.yml build -d - docker compose -f docker-compose.base.yml -f docker-compose.prod.yml up --remove-orphans + docker compose -f docker-compose.base.yml -f docker-compose.prod.yml build + docker compose -f docker-compose.base.yml -f docker-compose.prod.yml up -d --remove-orphans stop: docker compose -f docker-compose.base.yml -f docker-compose.prod.yml down diff --git a/app/shared/db/models.py b/app/shared/db/models.py index 761e251..e7c3375 100644 --- a/app/shared/db/models.py +++ b/app/shared/db/models.py @@ -41,10 +41,11 @@ class JobConfig(BaseModel): """(JSON) Configuration for a job.""" language: str | None = Field( + default=None, description=( "Spoken language in the media file. " "While optional, this can improve output." - ) + ), ) @@ -52,11 +53,13 @@ class JobMeta(BaseModel): """(JSON) Metadata relating to a job's execution.""" error: str | None = Field( - description="Will contain a descriptive error message if processing failed." + default=None, + description="Will contain a descriptive error message if processing failed.", ) task_id: uuid.UUID | None = Field( - description="Internal celery id of this job submission." + default=None, + description="Internal celery id of this job submission.", ) diff --git a/app/tests/conftest.py b/app/tests/conftest.py index 6460c18..7d4df65 100644 --- a/app/tests/conftest.py +++ b/app/tests/conftest.py @@ -47,7 +47,8 @@ def mock_job(db_session): job = models.Job( url="https://example.com", type=models.JobType.transcript, - status=models.JobStatus.create, + status=models.JobStatus.processing, + meta={"task_id": "5c790c76-2cc1-4e91-a305-443df55a4a4c"}, ) db_session.add(job) db_session.flush() diff --git a/app/web/dtos.py b/app/web/dtos.py index 4b0614f..7c476cd 100644 --- a/app/web/dtos.py +++ b/app/web/dtos.py @@ -33,6 +33,8 @@ class Job(WithDbFields): class Artifact(WithDbFields): + """A transcription artifact.""" + job_id: UUID data: ArtifactData type: ArtifactType diff --git a/app/web/main.py b/app/web/main.py index dd9a6ca..888185d 100644 --- a/app/web/main.py +++ b/app/web/main.py @@ -47,7 +47,7 @@ def api_root() -> None: response_model=list[dtos.Job], summary="Get metadata for all jobs", ) - def get_transcripts( + def get_jobs( session: DatabaseSession, type: dtos.JobType | None = None, ) -> list[models.Job]: @@ -65,7 +65,7 @@ def get_transcripts( response_model=dtos.Job, summary="Get metadata for one job", ) - def get_transcript( + def get_job( session: DatabaseSession, id: UUID = Path(), ) -> models.Job | None: