Automated Action fec0fa72e7 Initial project setup with FastAPI, SQLite, and Alembic
- Set up SQLite database configuration and directory structure
- Configure Alembic for proper SQLite migrations
- Add initial model schemas and API endpoints
- Fix OAuth2 authentication
- Implement proper code formatting with Ruff
2025-05-27 20:34:02 +00:00

43 lines
1.1 KiB
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class LocationBase(BaseModel):
"""Base schema for location data."""
name: str
latitude: float = Field(..., le=90, ge=-90)
longitude: float = Field(..., le=180, ge=-180)
country: Optional[str] = None
is_default: Optional[bool] = False
class LocationCreate(LocationBase):
"""Schema for creating a new location."""
pass
class LocationUpdate(BaseModel):
"""Schema for updating an existing location."""
name: Optional[str] = None
latitude: Optional[float] = Field(None, le=90, ge=-90)
longitude: Optional[float] = Field(None, le=180, ge=-180)
country: Optional[str] = None
is_default: Optional[bool] = None
class LocationInDBBase(LocationBase):
"""Base schema for location with DB fields."""
id: int
user_id: int
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
from_attributes = True
class Location(LocationInDBBase):
"""Schema for location response data."""
pass