add description in sell
This commit is contained in:
@ -29,7 +29,8 @@ async def sell_item(
|
|||||||
slot_index: int = Body(...),
|
slot_index: int = Body(...),
|
||||||
amount: int = Body(...),
|
amount: int = Body(...),
|
||||||
price: int = Body(...),
|
price: int = Body(...),
|
||||||
server_ip: str = Body(...)
|
server_ip: str = Body(...),
|
||||||
|
description: Optional[str] = None,
|
||||||
):
|
):
|
||||||
"""Выставить предмет на продажу"""
|
"""Выставить предмет на продажу"""
|
||||||
from app.services.marketplace import MarketplaceService
|
from app.services.marketplace import MarketplaceService
|
||||||
|
|||||||
@ -80,7 +80,7 @@ class MarketplaceService:
|
|||||||
raise HTTPException(status_code=404, detail="Предмет не найден")
|
raise HTTPException(status_code=404, detail="Предмет не найден")
|
||||||
return _serialize_mongodb_doc(item)
|
return _serialize_mongodb_doc(item)
|
||||||
|
|
||||||
async def add_item(self, username: str, slot_index: int, amount: int, price: int, server_ip: str):
|
async def add_item(self, username: str, slot_index: int, amount: int, price: int, server_ip: str, description: str):
|
||||||
"""Выставить предмет на продажу"""
|
"""Выставить предмет на продажу"""
|
||||||
# Создаем операцию продажи
|
# Создаем операцию продажи
|
||||||
operation_id = str(uuid.uuid4())
|
operation_id = str(uuid.uuid4())
|
||||||
@ -93,6 +93,7 @@ class MarketplaceService:
|
|||||||
"amount": amount,
|
"amount": amount,
|
||||||
"price": price,
|
"price": price,
|
||||||
"server_ip": server_ip,
|
"server_ip": server_ip,
|
||||||
|
"description": description,
|
||||||
"status": "pending",
|
"status": "pending",
|
||||||
"created_at": datetime.utcnow()
|
"created_at": datetime.utcnow()
|
||||||
}
|
}
|
||||||
@ -151,7 +152,7 @@ class MarketplaceService:
|
|||||||
"material": item_data.get("material"),
|
"material": item_data.get("material"),
|
||||||
"amount": item_data.get("amount"),
|
"amount": item_data.get("amount"),
|
||||||
"price": operation.get("price"),
|
"price": operation.get("price"),
|
||||||
"description": item_data.get("description"),
|
"description": operation.get("description"),
|
||||||
"image_url": item_data.get("image_url"),
|
"image_url": item_data.get("image_url"),
|
||||||
"seller_name": operation.get("player_name"),
|
"seller_name": operation.get("player_name"),
|
||||||
"server_ip": operation.get("server_ip"),
|
"server_ip": operation.get("server_ip"),
|
||||||
|
|||||||
Reference in New Issue
Block a user