Files
xenia-pos-local/local_backend/schemas/customers.py
T
bonaminandClaude Opus 5.5 bde125bf09 feat(manager): customers, throwaways, stock and notes on v2 (platform-v2 step 6.13b)
- CRM -> Customers: search ignoring case and Greek accents (and part of the phone), visits / spent / last visit,
  the card (contact, notes, open tab, every visit with what was on a tab), new/edit/remove
- Inventory -> Throwaways: log (product, quantity with a comma, reason, note) with its cost, today's list (delete today only),
  a period's totals by reason and product, every entry; Inventory -> Stock: an honest 'not available yet'
- Notes: notes (pinned first, edit in place) and to-dos (urgent first, done folded away, who did it kept)
- backend: crm.manage / inventory.manage / notes.use (the customer search also with the dashboard key, for orders);
  spending counted by services/sales.py (refunds off, tab lines in); null clears a field; names/notes not blank, priorities checked;
  waste ?date_from=&date_to= venue dates; the Greek reason labels left the API; live customers.changed / waste.changed / notes.changed
- the overview's notes card needs notes.use and refreshes live
- tests: test_customers_waste_notes.py (4), crm.test.mjs (3), e2e manager.mjs (customers, throwaways, notes, stock, Greek)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 18:36:27 +02:00

43 lines
1.0 KiB
Python

from pydantic import BaseModel
from typing import Optional, List
from datetime import datetime
class CustomerCreate(BaseModel):
name: str
nickname: Optional[str] = None
phone: Optional[str] = None
email: Optional[str] = None
notes: Optional[str] = None
class CustomerUpdate(BaseModel):
name: Optional[str] = None
nickname: Optional[str] = None
phone: Optional[str] = None
email: Optional[str] = None
notes: Optional[str] = None
is_active: Optional[bool] = None
class CustomerOut(BaseModel):
id: int
name: str
nickname: Optional[str] = None
phone: Optional[str] = None
email: Optional[str] = None
notes: Optional[str] = None
is_active: bool
created_at: datetime
created_by_id: int
# computed stats (set by router)
visit_count: int = 0
total_spent: float = 0.0
last_visit: Optional[datetime] = None
model_config = {"from_attributes": True}
class AssignCustomerRequest(BaseModel):
customer_id: Optional[int] = None # null = unassign