报表设置由覆盖改更新
This commit is contained in:
parent
ec7e579d42
commit
293f2853bb
@ -34,7 +34,8 @@ async def edit_show_report(
|
||||
) -> schemas.Msg:
|
||||
report_id = data_in.config.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:
|
||||
return schemas.Msg(code=0, msg='ok', data=data_in.config)
|
||||
elif res.modified_count == 0:
|
||||
|
@ -29,14 +29,14 @@ class DashboardDelete(BaseModel):
|
||||
|
||||
|
||||
class Report(BaseModel):
|
||||
name: str
|
||||
report_id: str
|
||||
graph_type: str
|
||||
ascending: bool
|
||||
model: str
|
||||
graph_size: str
|
||||
sort: int = 1
|
||||
modelswitch: bool = False
|
||||
name: str = None
|
||||
report_id: str = None
|
||||
graph_type: str = None
|
||||
ascending: bool = None
|
||||
model: str = None
|
||||
graph_size: str = None
|
||||
sort: int = None
|
||||
modelswitch: bool = None
|
||||
|
||||
|
||||
class EditShowReport(BaseModel):
|
||||
|
Loading…
Reference in New Issue
Block a user