diff --git a/app/models/pydantic/user_job.py b/app/models/pydantic/user_job.py index 4354ebbb..69855732 100644 --- a/app/models/pydantic/user_job.py +++ b/app/models/pydantic/user_job.py @@ -8,6 +8,7 @@ class UserJob(BaseModel): job_id: UUID + job_link: Optional[str] status: str = "pending" download_link: Optional[str] = None failed_geometries_link: Optional[str] = None diff --git a/app/routes/datasets/queries.py b/app/routes/datasets/queries.py index deddfff5..51ebdfe8 100755 --- a/app/routes/datasets/queries.py +++ b/app/routes/datasets/queries.py @@ -24,6 +24,7 @@ from pglast.parser import ParseError from pglast.printer import RawStream from pydantic.tools import parse_obj_as +from app.settings.globals import API_URL from ...application import db from ...authentication.api_keys import get_api_key @@ -419,7 +420,8 @@ async def query_dataset_list_post( logger.error(error) return HTTPException(500, "There was an error starting your job.") - return UserJobResponse(data=UserJob(job_id=job_id)) + job_link = f"{API_URL}/job/{job_id}" + return UserJobResponse(data=UserJob(job_id=job_id, job_link=job_link)) async def _start_batch_execution(job_id: UUID, input: Dict[str, Any]) -> None: diff --git a/tests_v2/unit/app/routes/datasets/test_query.py b/tests_v2/unit/app/routes/datasets/test_query.py index 52fec368..254bc9b9 100755 --- a/tests_v2/unit/app/routes/datasets/test_query.py +++ b/tests_v2/unit/app/routes/datasets/test_query.py @@ -703,6 +703,7 @@ async def test_query_batch_feature_collection( assert False assert str(uuid) == data["job_id"] + assert data["job_link"].endswith(f"/job/{data['job_id']}") assert data["status"] == "pending"