QC check
This commit is contained in:
@@ -1,16 +1,21 @@
|
||||
from typing import List, TypeVar, Generic
|
||||
from typing import Generic, List, TypeVar
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
T = TypeVar('T')
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class ListResponse(BaseModel, Generic[T]):
|
||||
"""Generic list response model"""
|
||||
|
||||
items: List[T]
|
||||
total: int
|
||||
skip: int
|
||||
limit: int
|
||||
|
||||
|
||||
class StatusResponse(BaseModel):
|
||||
"""Generic status response"""
|
||||
|
||||
success: bool
|
||||
message: str
|
||||
|
||||
@@ -3,8 +3,10 @@ from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field, field_validator
|
||||
|
||||
from models.api.stock import StockSummaryResponse
|
||||
|
||||
|
||||
class ProductBase(BaseModel):
|
||||
product_id: Optional[str] = None
|
||||
title: Optional[str] = None
|
||||
@@ -71,6 +73,7 @@ class ProductResponse(ProductBase):
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class ProductListResponse(BaseModel):
|
||||
products: List[ProductResponse]
|
||||
total: int
|
||||
|
||||
@@ -3,8 +3,10 @@ from datetime import datetime
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field, field_validator
|
||||
|
||||
from models.api.product import ProductResponse
|
||||
|
||||
|
||||
class ShopCreate(BaseModel):
|
||||
shop_code: str = Field(
|
||||
...,
|
||||
@@ -82,6 +84,7 @@ class ShopListResponse(BaseModel):
|
||||
skip: int
|
||||
limit: int
|
||||
|
||||
|
||||
class ShopProductCreate(BaseModel):
|
||||
product_id: str = Field(..., description="Product ID to add to shop")
|
||||
shop_product_id: Optional[str] = Field(
|
||||
|
||||
@@ -19,4 +19,4 @@ class MarketplaceStatsResponse(BaseModel):
|
||||
marketplace: str
|
||||
total_products: int
|
||||
unique_shops: int
|
||||
unique_brands: int
|
||||
unique_brands: int
|
||||
|
||||
@@ -43,4 +43,4 @@ class StockSummaryResponse(BaseModel):
|
||||
gtin: str
|
||||
total_quantity: int
|
||||
locations: List[StockLocationResponse]
|
||||
product_title: Optional[str] = None
|
||||
product_title: Optional[str] = None
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import Column, DateTime
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class TimestampMixin:
|
||||
"""Mixin to add created_at and updated_at timestamps to models"""
|
||||
|
||||
created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
|
||||
updated_at = Column(
|
||||
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
|
||||
|
||||
@@ -85,4 +85,3 @@ class Product(Base):
|
||||
f"<Product(product_id='{self.product_id}', title='{self.title}', marketplace='{self.marketplace}', "
|
||||
f"shop='{self.shop_name}')>"
|
||||
)
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ class Shop(Base):
|
||||
"MarketplaceImportJob", back_populates="shop"
|
||||
)
|
||||
|
||||
|
||||
class ShopProduct(Base):
|
||||
__tablename__ = "shop_products"
|
||||
|
||||
@@ -81,4 +82,3 @@ class ShopProduct(Base):
|
||||
Index("idx_shop_product_active", "shop_id", "is_active"),
|
||||
Index("idx_shop_product_featured", "shop_id", "is_featured"),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user