Update/fix plot params

This commit is contained in:
phil 2024-03-14 17:02:04 +05:30
parent 9c328642cb
commit e377c014a7
2 changed files with 19 additions and 4 deletions

View file

@ -16,7 +16,9 @@ from gisaf.models.authentication import (
) )
from gisaf.models.category import Category, CategoryRead from gisaf.models.category import Category, CategoryRead
from gisaf.models.geo_models_base import GeoModel, PlottableModel from gisaf.models.geo_models_base import GeoModel, PlottableModel
from gisaf.models.info import LegendItem, ModelAction, ModelInfo, DataProvider, ModelValue, TagActions from gisaf.models.info import (LegendItem, ModelAction, ModelInfo,
DataProvider, ModelValue, PlotParams,
TagActions)
from gisaf.models.measures import MeasuresItem from gisaf.models.measures import MeasuresItem
from gisaf.models.survey import Equipment, SurveyMeta, Surveyor from gisaf.models.survey import Equipment, SurveyMeta, Surveyor
from gisaf.config import Survey, conf from gisaf.config import Survey, conf
@ -355,6 +357,19 @@ async def get_model_info(
model_info['downloaders'] = plugin_manager.downloaders_stores[store] model_info['downloaders'] = plugin_manager.downloaders_stores[store]
return ModelInfo(**model_info) return ModelInfo(**model_info)
@api.get("/plot-params/{store}")
async def get_plot_params(
store: str, id: str, value: str
) -> PlotParams:
model = registry.geom.get(store)
## Get additional plot params
if hasattr(model, 'get_plot_params'):
plot_params: PlotParams = await model.get_plot_params(id, value)
return plot_params
else:
raise HTTPException(status_code=status.HTTP_204_NO_CONTENT)
# @api.get("/user-role") # @api.get("/user-role")
# async def get_user_role_relation( # async def get_user_role_relation(
# *, db_session: AsyncSession = Depends(get_db_session) # *, db_session: AsyncSession = Depends(get_db_session)

View file

@ -39,9 +39,9 @@ class PlotBaseLine(BaseModel):
class PlotParams(BaseModel): class PlotParams(BaseModel):
baseLines: list[PlotBaseLine] baseLines: list[PlotBaseLine] = []
bgShape: list[PlotBgShape] bgShapes: list[PlotBgShape] = []
barBase: float barBase: float | None = None
class Attachment(BaseModel): class Attachment(BaseModel):