报表设置由覆盖改更新
This commit is contained in:
parent
ec7e579d42
commit
293f2853bb
@ -34,7 +34,8 @@ async def edit_show_report(
|
|||||||
) -> schemas.Msg:
|
) -> schemas.Msg:
|
||||||
report_id = data_in.config.report_id
|
report_id = data_in.config.report_id
|
||||||
res = await crud.dashboard.update_one(db, {'_id': data_in.dashboard_id, 'reports.report_id': report_id},
|
res = await crud.dashboard.update_one(db, {'_id': data_in.dashboard_id, 'reports.report_id': report_id},
|
||||||
{'$set': {f'reports.$.{k}': v for k, v in data_in.config.dict().items()}})
|
{'$set': {f'reports.$.{k}': v for k, v in
|
||||||
|
data_in.config.dict(skip_defaults=True).items()}})
|
||||||
if res.modified_count == 1:
|
if res.modified_count == 1:
|
||||||
return schemas.Msg(code=0, msg='ok', data=data_in.config)
|
return schemas.Msg(code=0, msg='ok', data=data_in.config)
|
||||||
elif res.modified_count == 0:
|
elif res.modified_count == 0:
|
||||||
|
@ -29,14 +29,14 @@ class DashboardDelete(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class Report(BaseModel):
|
class Report(BaseModel):
|
||||||
name: str
|
name: str = None
|
||||||
report_id: str
|
report_id: str = None
|
||||||
graph_type: str
|
graph_type: str = None
|
||||||
ascending: bool
|
ascending: bool = None
|
||||||
model: str
|
model: str = None
|
||||||
graph_size: str
|
graph_size: str = None
|
||||||
sort: int = 1
|
sort: int = None
|
||||||
modelswitch: bool = False
|
modelswitch: bool = None
|
||||||
|
|
||||||
|
|
||||||
class EditShowReport(BaseModel):
|
class EditShowReport(BaseModel):
|
||||||
|
Loading…
Reference in New Issue
Block a user