feat(chalice): fixed update card
This commit is contained in:
parent
cd4d0a56df
commit
3c73aa6a9e
3 changed files with 6 additions and 2 deletions
|
|
@ -298,7 +298,7 @@ def create(project_id, user_id, data: schemas_ee.CreateCardSchema, dashboard=Fal
|
|||
return {"data": get_card(metric_id=r["metric_id"], project_id=project_id, user_id=user_id)}
|
||||
|
||||
|
||||
def update(metric_id, user_id, project_id, data: schemas.UpdateCardSchema):
|
||||
def update(metric_id, user_id, project_id, data: schemas_ee.UpdateCardSchema):
|
||||
metric = get_card(metric_id=metric_id, project_id=project_id, user_id=user_id, flatten=False)
|
||||
if metric is None:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ def get_card_chart(projectId: int, metric_id: int, data: schemas.CardChartSchema
|
|||
@app.put('/{projectId}/metrics/{metric_id}', tags=["dashboard"])
|
||||
@app.post('/{projectId}/custom_metrics/{metric_id}', tags=["customMetrics"])
|
||||
@app.put('/{projectId}/custom_metrics/{metric_id}', tags=["customMetrics"])
|
||||
def update_custom_metric(projectId: int, metric_id: int, data: schemas.UpdateCardSchema = Body(...),
|
||||
def update_custom_metric(projectId: int, metric_id: int, data: schemas_ee.UpdateCardSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = custom_metrics.update(project_id=projectId, user_id=context.user_id, metric_id=metric_id, data=data)
|
||||
if data is None:
|
||||
|
|
|
|||
|
|
@ -167,3 +167,7 @@ class CreateCardSchema(schemas.CreateCardSchema):
|
|||
f"metricValue should be of type [InsightCategories] for metricType:{schemas.MetricType.insights}"
|
||||
|
||||
return values
|
||||
|
||||
|
||||
class UpdateCardSchema(CreateCardSchema):
|
||||
series: List[schemas.CardUpdateSeriesSchema] = Field(...)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue