This commit is contained in:
wuaho 2021-08-30 16:52:02 +08:00
parent a68a4fb563
commit 91c8ecc760

View File

@ -104,12 +104,17 @@ async def copy(
new_report_id = get_uid()
new_report['_id'] = new_report_id
new_report['project_id'] = dest_project_id
await crud.report.insert_one(db, new_report)
await crud.dashboard.update_one(db,
{'project_id': item['project_id'], 'name': item['name'],
'user_id': item['user_id']}, {'$set': item},
upsert=True)
try:
await crud.report.insert_one(db, new_report)
except:
pass
try:
await crud.dashboard.update_one(db,
{'project_id': item['project_id'], 'name': item['name'],
'user_id': item['user_id']}, {'$set': item},
upsert=True)
except:
pass
return schemas.Msg(code=0, msg='ok', data='复制成功')