Unify parsing workers, analytics API with PostgreSQL, map UI, and PI distribution into centers/ with Docker Compose. Co-authored-by: Cursor <cursoragent@cursor.com>
49 lines
1.2 KiB
Python
49 lines
1.2 KiB
Python
from datetime import datetime
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
ObjectType = Literal["point", "marker", "zone", "other"]
|
|
|
|
|
|
class MapObjectCreate(BaseModel):
|
|
name: str = Field(min_length=1, max_length=255)
|
|
description: str = ""
|
|
type: ObjectType
|
|
latitude: float = Field(ge=-90, le=90)
|
|
longitude: float = Field(ge=-180, le=180)
|
|
created_at: datetime | None = None
|
|
|
|
|
|
class MapObjectRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
name: str
|
|
description: str
|
|
type: ObjectType
|
|
latitude: float
|
|
longitude: float
|
|
created_at: datetime
|
|
|
|
|
|
class MapObjectUpdate(BaseModel):
|
|
name: str | None = Field(default=None, min_length=1, max_length=255)
|
|
description: str | None = None
|
|
type: ObjectType | None = None
|
|
latitude: float | None = Field(default=None, ge=-90, le=90)
|
|
longitude: float | None = Field(default=None, ge=-180, le=180)
|
|
created_at: datetime | None = None
|
|
|
|
|
|
class ObjectMediaRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
object_id: int
|
|
original_name: str
|
|
content_type: str
|
|
size: int
|
|
created_at: datetime
|
|
url: str
|