This commit is contained in:
vladislav 2026-09-01 11:23:06 -04:00
parent 40b01f7b02
commit de3a5e735d
Signed by: Vladislav
GPG Key ID: D97C9E5E4860EE45
2 changed files with 10 additions and 4 deletions

View File

@ -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"

View File

@ -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)