Fix api stores

Rename in category table: geom_type to gis_type
This commit is contained in:
phil 2023-12-27 01:11:54 +05:30
parent c0c308a657
commit 956147aea8
7 changed files with 45 additions and 22 deletions

View file

@ -60,9 +60,9 @@ class CategoryBase(BaseModel):
status: str = Field(min_length=1, max_length=1)
custom: bool | None
auto_import: bool = True
geom_type: str = Field(max_length=50,
foreign_key='category_model_type.name',
default='Point')
gis_type: str = Field(max_length=50,
foreign_key='category_model_type.name',
default='Point')
long_name: str | None = Field(max_length=50)
style: str | None = Field(sa_type=TEXT)
symbol: str | None = Field(max_length=1)
@ -108,7 +108,7 @@ class CategoryBase(BaseModel):
@computed_field
@property
def mapbox_type(self) -> str:
return self.mapbox_type_custom or mapbox_type_mapping[self.geom_type]
return self.mapbox_type_custom or mapbox_type_mapping[self.gis_type]
class Category(CategoryBase, table=True):

View file

@ -287,6 +287,9 @@ class GeoModel(Model):
Base class for all geo models
"""
#__abstract__ = True
id: int | None = Field(default=None, primary_key=True)
description: ClassVar[str] = ''
attribution: ClassVar[str | None] = None

View file

@ -8,7 +8,7 @@ class MapLibreStyle(BaseModel):
class Store(BaseModel):
auto_import: bool
base_gis_type: str
# base_gis_type: str
count: int
custom: bool
description: str
@ -23,12 +23,12 @@ class Store(BaseModel):
#mapbox_layout: dict[str, Any] | None
#mapbox_paint: dict[str, Any] | None
#mapbox_type: str
mapbox_type_custom: str | None
# mapbox_type_custom: str | None
#mapbox_type_default: str
minor_group_1: str
minor_group_2: str
minor_group_1: str | None
minor_group_2: str | None
#model: GeoModel
geom_type: str
gis_type: str
name: str
#name_letter: str
#name_number: int