32 lines
687 B
Python
32 lines
687 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from typing import Optional
|
||
|
|
from pydantic import BaseModel, Field
|
||
|
|
|
||
|
|
|
||
|
|
class RegisterRequest(BaseModel):
|
||
|
|
uuid: str = Field(..., min_length=1)
|
||
|
|
name: str = Field(..., min_length=1, max_length=100)
|
||
|
|
|
||
|
|
|
||
|
|
class RegisterResponse(BaseModel):
|
||
|
|
user_id: int
|
||
|
|
uuid: str
|
||
|
|
|
||
|
|
|
||
|
|
class GeoData(BaseModel):
|
||
|
|
lat: float = Field(..., ge=-90.0, le=90.0)
|
||
|
|
lon: float = Field(..., ge=-180.0, le=180.0)
|
||
|
|
accuracy: float = Field(..., gt=0)
|
||
|
|
|
||
|
|
|
||
|
|
class SignalRequest(BaseModel):
|
||
|
|
user_id: str = Field(..., min_length=1)
|
||
|
|
timestamp: int = Field(..., gt=0)
|
||
|
|
geo: Optional[GeoData] = None
|
||
|
|
|
||
|
|
|
||
|
|
class SignalResponse(BaseModel):
|
||
|
|
status: str
|
||
|
|
signal_id: int
|