Fix FastAPI doc pages.

We can't directly use frozen dataclasses from pydcs in our interface
because pydantic can't process them. Pydantic is able to automatically
convert to our modelview type from the pydcs type though.
This commit is contained in:
Dan Albert
2022-02-25 16:34:11 -08:00
parent 45e76e12b6
commit d6e82d44fc
6 changed files with 25 additions and 16 deletions

View File

@@ -2,17 +2,17 @@ from __future__ import annotations
from uuid import UUID
from dcs.mapping import LatLng
from pydantic import BaseModel
from game.ato import Flight
from game.ato.flightstate import InFlight
from game.server.leaflet import LeafletPoint
class FlightJs(BaseModel):
id: UUID
blue: bool
position: LatLng | None
position: LeafletPoint | None
@staticmethod
def for_flight(flight: Flight) -> FlightJs: