summaryrefslogtreecommitdiff
path: root/apirouters/customize_ship.py
blob: 5f0666e527399c62af0ab51ca06822362aa76715 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()