Skip to content

Commit

Permalink
Merge pull request #2078 from hotosm/fix/geom-to-geojson
Browse files Browse the repository at this point in the history
Change geom to geojson in db model
  • Loading branch information
Sujanadh authored Jan 10, 2025
2 parents 056c3b5 + 22f0fee commit 00f2a03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/backend/app/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ def slugify(name: Optional[str]) -> Optional[str]:
class DbGeometryLog(BaseModel):
"""Table geometry log."""

geom: dict
geojson: dict
status: GeomStatus
project_id: Optional[int] = None
task_id: Optional[int] = None
Expand All @@ -1793,7 +1793,7 @@ async def create(

for key in model_dump.keys():
columns.append(key)
if key == "geom":
if key == "geojson":
value_placeholders.append(f"%({key})s::jsonb")
# Must be string json for db input
model_dump[key] = json.dumps(model_dump[key])
Expand Down
4 changes: 2 additions & 2 deletions src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class GeometryLogIn(BaseModel):
"""Geometry log insert."""

status: GeomStatus
geom: dict
geojson: dict
project_id: Optional[int] = None
task_id: Optional[int] = None

@field_validator("geom", mode="before")
@field_validator("geojson", mode="before")
@classmethod
def parse_input_geometry(
cls,
Expand Down

0 comments on commit 00f2a03

Please sign in to comment.