Add missing model info, fix collision with tags

This commit is contained in:
phil 2024-03-09 00:32:58 +05:30
parent 69924709d2
commit 9bf78dd421
5 changed files with 26 additions and 21 deletions

View file

@ -40,7 +40,7 @@ from gisaf.models.models_base import Model
from gisaf.models.metadata import gisaf_survey, gisaf_admin, survey, raw_survey
from gisaf.models.misc import Qml
from gisaf.models.category import Category
from gisaf.models.info_item import InfoItem
from gisaf.models.info_item import Tag, InfoItem
# from gisaf.models.survey import Equipment, Surveyor, Accuracy
# from gisaf.models.project import Project
@ -383,11 +383,11 @@ class GeoModelNoStatus(Model):
"""
return []
async def get_info(self) -> dict[str, str]:
async def get_info(self) -> list[InfoItem]:
"""
Model specific info
"""
return {}
return []
# @classmethod
# def get_join_with(cls):
@ -433,18 +433,18 @@ class GeoModelNoStatus(Model):
async def get_properties(cls, df):
return {}
async def get_tags(self) -> list[InfoItem]:
async def get_tags(self) -> list[Tag]:
from gisaf.models.tags import Tags
async with db_session() as session:
query = select(Tags.tags).where(Tags.store == self.get_store_name(),
Tags.ref_id == self.id)
data = await session.exec(query)
tags = data.one_or_none()
if tags is not None:
return [InfoItem(key=key, value=value)
for key, value in tags.items()]
else:
return []
if tags is not None:
return [Tag(key=key, value=value)
for key, value in tags.items()]
else:
return []
@cached_property
def shapely_geom(self):