Files
popa_minecraft_launcher_api/app/api/server.py

22 lines
678 B
Python

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
router = APIRouter(
prefix="/api/server",
tags=["Server Management"]
)
@router.post("/events")
async def receive_server_event(event_data: dict):
return await EventService().process_event(event_data)
@router.post("/commands")
async def add_server_command(command_data: ServerCommand):
return await CommandService().add_command(command_data)
@router.get("/commands")
async def get_server_commands(server_ip: str):
return await CommandService().get_commands(server_ip)