schemas.py 823 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from enum import Enum
  2. from fastapi_camelcase import CamelModel
  3. from pydantic import conint, confloat
  4. class GenMethodEnum(str, Enum):
  5. map_crunch = "MAPCRUNCH"
  6. rsv = "RANDOMSTREETVIEW"
  7. urban = "URBAN"
  8. class RuleSetEnum(str, Enum):
  9. normal = "NORMAL"
  10. time_bank = "TIMEBANK"
  11. frozen = "FROZEN"
  12. race = "RACE"
  13. class GameConfig(CamelModel):
  14. timer: conint(gt=0)
  15. rounds: conint(gt=0)
  16. only_america: bool = False
  17. generation_method: GenMethodEnum = GenMethodEnum.map_crunch
  18. rule_set: RuleSetEnum = RuleSetEnum.normal
  19. class Config:
  20. orm_mode = True
  21. class Guess(CamelModel):
  22. lat: confloat(ge=-90.0, le=90.0)
  23. lng: confloat(ge=-180.0, le=180.0)
  24. time_remaining: int
  25. class CacheInfo(CamelModel):
  26. generation_method: str
  27. only_america: bool
  28. size: int