- Add migrations 019/020: extend Person (first/last name, nickname, is_favourite, company, job_title, mobile, category) and Location (is_frequent, contact_number, email) - Update Person/Location models, schemas, and routers with new fields + name denormalisation - Create shared component library: EntityTable, EntityDetailPanel, CategoryFilterBar, CopyableField, CategoryAutocomplete, useTableVisibility hook - Rebuild LocationsPage: table layout with sortable columns, detail side panel, category filter bar, frequent pinned section - Extend LocationForm with contact number, email, frequent toggle, category autocomplete - Add animated panel transitions to ProjectDetail (55/45 split with cubic-bezier easing) - Update TypeScript interfaces for Person and Location Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
from pydantic import BaseModel, ConfigDict
|
|
from datetime import datetime
|
|
from typing import Optional, Literal
|
|
|
|
|
|
class LocationSearchResult(BaseModel):
|
|
source: Literal["local", "nominatim"]
|
|
location_id: Optional[int] = None
|
|
name: str
|
|
address: str
|
|
|
|
|
|
class LocationCreate(BaseModel):
|
|
name: str
|
|
address: str
|
|
category: str = "other"
|
|
notes: Optional[str] = None
|
|
is_frequent: bool = False
|
|
contact_number: Optional[str] = None
|
|
email: Optional[str] = None
|
|
|
|
|
|
class LocationUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
address: Optional[str] = None
|
|
category: Optional[str] = None
|
|
notes: Optional[str] = None
|
|
is_frequent: Optional[bool] = None
|
|
contact_number: Optional[str] = None
|
|
email: Optional[str] = None
|
|
|
|
|
|
class LocationResponse(BaseModel):
|
|
id: int
|
|
name: str
|
|
address: str
|
|
category: str
|
|
notes: Optional[str]
|
|
is_frequent: bool
|
|
contact_number: Optional[str]
|
|
email: Optional[str]
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|