Skip to content

Commit 32c6331

Browse files
authored
Merge pull request #19 from Geode-solutions/fix/viewer_elements_type
fix(DataBase): add viewer_elements_type
2 parents f73b930 + 896aaf4 commit 32c6331

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/opengeodeweb_microservice/database/data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Data(Base):
1313
)
1414
geode_object: Mapped[str] = mapped_column(String, nullable=False)
1515
viewer_object: Mapped[str] = mapped_column(String, nullable=False)
16+
viewer_elements_type: Mapped[str] = mapped_column(String, nullable=False)
1617

1718
native_file: Mapped[str | None] = mapped_column(String, nullable=True)
1819
viewable_file: Mapped[str | None] = mapped_column(String, nullable=True)
@@ -25,12 +26,14 @@ class Data(Base):
2526
def create(
2627
geode_object: str,
2728
viewer_object: str,
29+
viewer_elements_type: str,
2830
input_file: str | None = None,
2931
additional_files: list[str] | None = None,
3032
) -> "Data":
3133
data_entry = Data(
3234
geode_object=geode_object,
3335
viewer_object=viewer_object,
36+
viewer_elements_type=viewer_elements_type,
3437
input_file=input_file,
3538
additional_files=additional_files,
3639
)

tests/test_database.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ def test_data_crud_operations(clean_database: None) -> None:
55
data = Data.create(
66
geode_object="test_object",
77
viewer_object="test_viewer",
8+
viewer_elements_type="test_type",
89
input_file="test.txt",
910
additional_files=[],
1011
)
@@ -27,6 +28,7 @@ def test_data_with_additional_files(clean_database: None) -> None:
2728
data = Data.create(
2829
geode_object="test_files",
2930
viewer_object="test_viewer",
31+
viewer_elements_type="test_type",
3032
additional_files=files,
3133
)
3234
assert data.id is not None

0 commit comments

Comments
 (0)