diff --git a/api/api_v1/endpoints/dashboard.py b/api/api_v1/endpoints/dashboard.py index 9aa7b3e..6bee891 100644 --- a/api/api_v1/endpoints/dashboard.py +++ b/api/api_v1/endpoints/dashboard.py @@ -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='倍刢成功')