from typing import Annotated from fastapi import APIRouter, Depends from pydantic import BaseModel from ..modules import ships from ..entities.ship import Ship router = APIRouter() class RenameBody(BaseModel): name: str @router.post("/customize_ship/{ship_symbol}/rename") async def rename(rename_body: RenameBody, ship: Annotated[Ship, Depends(ships.get_ship)]): ship.rename(rename_body.name) return ship.get_data()