brands-in-shops feature implemented

This commit is contained in:
2025-05-27 23:41:04 +02:00
parent 7037be370e
commit 2846bcbb1c
9 changed files with 559 additions and 36 deletions

View File

@@ -20,6 +20,28 @@ class Brand(BrandBase):
class Config:
from_attributes = True
# BrandInShop schemas
class BrandInShopBase(BaseModel):
shop_id: int
brand_id: int
class BrandInShopCreate(BrandInShopBase):
pass
class BrandInShopUpdate(BaseModel):
shop_id: Optional[int] = None
brand_id: Optional[int] = None
class BrandInShop(BrandInShopBase):
id: int
created_at: datetime
updated_at: Optional[datetime] = None
shop: "Shop"
brand: "Brand"
class Config:
from_attributes = True
# Grocery Category schemas
class GroceryCategoryBase(BaseModel):
name: str
@@ -168,4 +190,7 @@ class ShopStats(BaseModel):
shop_name: str
total_spent: float
visit_count: int
avg_per_visit: float
avg_per_visit: float
# Update forward references
BrandInShop.model_rebuild()