Skip to content

Commit 5ac94f6

Browse files
committed
Merge branch 'feat/create_voi' of https://github.com/Geode-solutions/OpenGeodeWeb-Back into feat/create_voi
2 parents e77805a + 84cbd39 commit 5ac94f6

5 files changed

Lines changed: 63 additions & 50 deletions

File tree

opengeodeweb_back_schemas.json

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
{
22
"opengeodeweb_back": {
33
"create": {
4+
"create_voi": {
5+
"$id": "opengeodeweb_back/create/create_voi",
6+
"route": "/create_voi",
7+
"methods": [
8+
"POST"
9+
],
10+
"type": "object",
11+
"properties": {
12+
"name": {
13+
"type": "string",
14+
"description": "Name of the VOI"
15+
},
16+
"aoi_id": {
17+
"type": "string",
18+
"description": "ID of the corresponding AOI"
19+
},
20+
"z_min": {
21+
"type": "number",
22+
"description": "Minimum Z coordinate"
23+
},
24+
"z_max": {
25+
"type": "number",
26+
"description": "Maximum Z coordinate"
27+
},
28+
"id": {
29+
"type": "string",
30+
"description": "Optional ID for updating existing VOI"
31+
}
32+
},
33+
"required": [
34+
"name",
35+
"aoi_id",
36+
"z_min",
37+
"z_max"
38+
],
39+
"additionalProperties": false
40+
},
441
"create_point": {
542
"$id": "opengeodeweb_back/create/create_point",
643
"route": "/create_point",
@@ -76,43 +113,6 @@
76113
"z"
77114
],
78115
"additionalProperties": false
79-
},
80-
"create_voi": {
81-
"$id": "opengeodeweb_back/create/create_voi",
82-
"route": "/create_voi",
83-
"methods": [
84-
"POST"
85-
],
86-
"type": "object",
87-
"properties": {
88-
"name": {
89-
"type": "string",
90-
"description": "Name of the VOI"
91-
},
92-
"aoi_id": {
93-
"type": "string",
94-
"description": "ID of the corresponding AOI"
95-
},
96-
"z_min": {
97-
"type": "number",
98-
"description": "Minimum Z coordinate"
99-
},
100-
"z_max": {
101-
"type": "number",
102-
"description": "Maximum Z coordinate"
103-
},
104-
"id": {
105-
"type": "string",
106-
"description": "Optional ID for updating existing VOI"
107-
}
108-
},
109-
"required": [
110-
"name",
111-
"aoi_id",
112-
"z_min",
113-
"z_max"
114-
],
115-
"additionalProperties": false
116116
}
117117
},
118118
"models": {

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ werkzeug==3.1.2
6060
# flask
6161
# flask-cors
6262

63-
opengeodeweb-microservice==1.*,>=1.0.6rc1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1+
from .create_voi import *
12
from .create_point import *
23
from .create_aoi import *
3-
from .create_voi import *

src/opengeodeweb_back/routes/create/schemas/create_voi.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@
22
from dataclasses import dataclass
33
from typing import Optional
44

5+
56
@dataclass
67
class CreateVoi(DataClassJsonMixin):
7-
name: str
8-
"""Name of the VOI"""
9-
108
aoi_id: str
119
"""ID of the corresponding AOI"""
1210

13-
z_min: float
14-
"""Minimum Z coordinate for the VOI"""
11+
max_x: float
12+
"""Maximum X coordinate from AOI"""
13+
14+
max_y: float
15+
"""Maximum Y coordinate from AOI"""
16+
17+
min_x: float
18+
"""Minimum X coordinate from AOI"""
19+
20+
min_y: float
21+
"""Minimum Y coordinate from AOI"""
22+
23+
name: str
24+
"""Name of the VOI"""
1525

1626
z_max: float
17-
"""Maximum Z coordinate for the VOI"""
27+
"""Maximum Z coordinate"""
28+
29+
z_min: float
30+
"""Minimum Z coordinate"""
1831

1932
id: Optional[str] = None
33+
"""Optional ID for updating existing VOI"""

tests/test_create_routes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ def aoi_data() -> Dict[str, Any]:
2929
"z": 0.0,
3030
}
3131

32+
3233
@pytest.fixture
3334
def voi_data() -> Dict[str, Any]:
3435
"""Fixture for Volume of Interest (VOI) test data."""
3536
return {
3637
"name": "test_voi",
37-
"aoi_id": str(uuid.uuid4()),
38+
"aoi_id": str(uuid.uuid4()),
3839
"z_min": -50.0,
3940
"z_max": 100.0,
40-
"id": str(uuid.uuid4()),
41+
"id": str(uuid.uuid4()),
4142
}
4243

4344

@@ -113,9 +114,8 @@ def test_create_voi(client: FlaskClient, voi_data: Dict[str, Any]) -> None:
113114

114115
voi_data_required_only = voi_data.copy()
115116
del voi_data_required_only["id"]
116-
117-
test_utils.test_route_wrong_params(client, route, lambda: voi_data_required_only.copy()) # type: ignore
118117

118+
test_utils.test_route_wrong_params(client, route, lambda: voi_data_required_only.copy()) # type: ignore
119119

120120

121121
def test_create_point_with_invalid_data(client: FlaskClient) -> None:
@@ -183,7 +183,7 @@ def test_create_voi_with_invalid_data(
183183
invalid_data = {**voi_data, "z_max": "not_a_number"}
184184
response = client.post(route, json=invalid_data)
185185
assert response.status_code == 400
186-
186+
187187
# Test with invalid aoi_id format (e.g., not a string/uuid)
188188
invalid_data = {**voi_data, "aoi_id": 12345}
189189
response = client.post(route, json=invalid_data)

0 commit comments

Comments
 (0)