fix
This commit is contained in:
parent
40b01f7b02
commit
de3a5e735d
@ -3235,9 +3235,12 @@
|
||||
"@app.put(\"/api/post/{post_id}/sale\", response_model=dict)\n",
|
||||
"async def sale_painting(\n",
|
||||
" post_id: str,\n",
|
||||
" current_user: Dict = Security(get_current_user, scopes=[\"create:posts\"])\n",
|
||||
" current_user: Dict = Security(get_current_user)\n",
|
||||
" ):\n",
|
||||
" await posts_collection.update_one({'_id': ObjectId(post_id), 'user._id': current_user.get('_id')}, {'$set': {\"status\": \"Продано\"}})\n",
|
||||
" fin = [{'_id': ObjectId(post_id), 'user._id': current_user.get('_id')}]\n",
|
||||
" if 'partner' in current_user.roles:\n",
|
||||
" fin.append({'_id': ObjectId(post_id)})\n",
|
||||
" await posts_collection.update_one({'$or': fin}, {'$set': {\"status\": \"Продано\"}})\n",
|
||||
" return {'ok': True}"
|
||||
],
|
||||
"display_name": ".venv"
|
||||
|
||||
7
main.py
7
main.py
@ -2401,9 +2401,12 @@ async def post_painting(
|
||||
@app.put("/api/post/{post_id}/sale", response_model=dict)
|
||||
async def sale_painting(
|
||||
post_id: str,
|
||||
current_user: Dict = Security(get_current_user, scopes=["create:posts"])
|
||||
current_user: Dict = Security(get_current_user)
|
||||
):
|
||||
await posts_collection.update_one({'_id': ObjectId(post_id), 'user._id': current_user.get('_id')}, {'$set': {"status": "Продано"}})
|
||||
fin = [{'_id': ObjectId(post_id), 'user._id': current_user.get('_id')}]
|
||||
if 'partner' in current_user.roles:
|
||||
fin.append({'_id': ObjectId(post_id)})
|
||||
await posts_collection.update_one({'$or': fin}, {'$set': {"status": "Продано"}})
|
||||
return {'ok': True}
|
||||
|
||||
@app.put("/api/post/{post_id}", response_model=dict)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user