add: getting player inventory

This commit is contained in:
2025-07-19 01:20:26 +05:00
parent 259e3c373b
commit 44e12723ad
3 changed files with 209 additions and 16 deletions

View File

@ -1,7 +1,7 @@
from fastapi import APIRouter
from app.services.server.command import CommandService
from app.services.server.event import EventService
from app.models.server.command import ServerCommand
from app.models.server.command import ServerCommand, InventoryRequest
from datetime import datetime
import uuid
@ -28,6 +28,26 @@ async def add_server_command(command_data: ServerCommand):
async def get_server_commands(server_ip: str):
return await CommandService().get_commands(server_ip)
@router.post("/inventory")
async def request_player_inventory(inventory_request: InventoryRequest):
"""Создаёт запрос на получение инвентаря игрока"""
return await CommandService().request_inventory(inventory_request)
@router.get("/inventory/requests")
async def get_inventory_requests(server_ip: str):
"""Получает список запросов инвентаря для сервера"""
return await CommandService().get_inventory_requests(server_ip)
@router.post("/inventory/submit")
async def submit_inventory(inventory_data: dict):
"""Принимает данные инвентаря от сервера"""
return await CommandService().submit_inventory(inventory_data)
@router.get("/inventory/{request_id}")
async def get_inventory_result(request_id: str):
"""Получает результаты запроса инвентаря"""
return await CommandService().get_inventory_result(request_id)
async def update_server_activity(server_ip):
"""Обновляет время последней активности сервера"""
from app.db.database import db