Add missing dependencies

Add tile server
Config: add defults
Cosmetic refactorings
This commit is contained in:
phil 2024-02-10 19:26:38 +05:30
parent 7e9e266157
commit 5dacc908f2
12 changed files with 434 additions and 187 deletions

View file

@ -186,7 +186,7 @@ class SurveyModel(BaseSurveyModel):
@declared_attr
def __tablename__(cls) -> str:
return cls.__name__ # type: nocheck
return cls.__name__ # type: ignore
async def get_survey_info(self):
info = await super(SurveyModel, self).get_survey_info()

View file

@ -11,7 +11,7 @@ from gisaf.models.store import Store
class BaseStyle(Model, table=True):
__table_args__ = gisaf_map.table_args
__tablename__ = 'map_base_style'
__tablename__: str = 'map_base_style' # type: ignore
class Admin:
menu = 'Other'
@ -19,18 +19,18 @@ class BaseStyle(Model, table=True):
id: int | None = Field(primary_key=True, default=None)
name: str
style: dict[str, Any] | None = Field(sa_type=JSON(none_as_null=True))
mbtiles: str = Field(sa_type=String(50))
style: dict[str, Any] | None = Field(sa_type=JSON(none_as_null=True)) # type: ignore
mbtiles: str = Field(sa_type=String(50)) # type: ignore
static_tiles_url: str
enabled: bool = True
def __repr__(self):
return '<models.BaseStyle {self.name:s}>'.format(self=self)
return f'<models.BaseStyle {self.name:s}>'
class BaseMap(Model, table=True):
__table_args__ = gisaf_map.table_args
__tablename__ = 'base_map'
__tablename__: str = 'base_map' # type: ignore
class Admin:
menu = 'Other'
@ -39,14 +39,14 @@ class BaseMap(Model, table=True):
name: str
layers: list['BaseMapLayer'] = Relationship(back_populates='base_map')
def __repr__(self):
return '<models.BaseMap {self.name:s}>'.format(self=self)
def __repr__(self) -> str:
return f'<models.BaseMap {self.name:s}>'
def __str__(self):
def __str__(self) -> str:
return self.name
@classmethod
def selectinload(cls):
def selectinload(cls) -> list[list['BaseMapLayer']]:
return [
cls.layers
]
@ -54,7 +54,7 @@ class BaseMap(Model, table=True):
class BaseMapLayer(Model, table=True):
__table_args__ = gisaf_map.table_args
__tablename__ = 'base_map_layer'
__tablename__: str = 'base_map_layer' # type: ignore
class Admin:
menu = 'Other'
@ -63,7 +63,7 @@ class BaseMapLayer(Model, table=True):
base_map_id: int = Field(foreign_key=gisaf_map.table('base_map.id'),
index=True)
base_map: BaseMap = Relationship(back_populates='layers')
store: str = Field(sa_type=String(100))
store: str = Field(sa_type=String(100)) # type: ignore
@classmethod
def selectinload(cls):