Skip to content

Commit

Permalink
fix: allow empty task id and osm id for new geopoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sujanadh committed Sep 10, 2024
1 parent ad9abad commit 755c0e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/backend/app/central/central_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,13 @@ async def get_entities_data(

# Rename '__id' to 'id'
flattened_dict["id"] = flattened_dict.pop("__id")

# convert empty str task_id and osm_id to None
# when new entities are created task_id and osm_id will be empty
if "task_id" in flattened_dict and flattened_dict["task_id"] == "":
flattened_dict["task_id"] = None
if "osm_id" in flattened_dict and flattened_dict["osm_id"] == "":
flattened_dict["osm_id"] = None
all_entities.append(flattened_dict)

return all_entities
Expand Down
2 changes: 1 addition & 1 deletion src/backend/app/central/central_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class EntityTaskID(BaseModel):
"""Map of Entity UUID to FMTM Task ID."""

id: str
task_id: int
task_id: Optional[int] = None


class EntityMappingStatus(EntityOsmID, EntityTaskID):
Expand Down

0 comments on commit 755c0e1

Please sign in to comment.