Commit 5ac865ef authored by 陈涛's avatar 陈涛

修改解除绑定bug

parent 7d3ec615
......@@ -52,11 +52,10 @@ async def unsubscribe(
user: User = Depends(dependencies.get_current_user),
fund_collect: AgnosticCollection = Depends(dependencies.get_fund_collect)
):
db_data = BaseNode(**create_node.dict())
query = {'id': create_node.fund_id, 'user_id': user.id, 'fund_type': FundType.staking}
res = await fund_collect.update_one(
{**query, "nodes": {"$elemMatch": {"pub_key": create_node.pub_key}}},
{"$pull": {"nodes": {"pub_key": db_data.pub_key}}}
{"$pull": {"nodes": {"pub_key": create_node.pub_key}}}
)
if res.raw_result['nModified'] == 0:
raise ExistDataError(message='解绑失败,检查节点是否存在')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment