Advertisement
bagsari

Untitled

Sep 16th, 2024
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. from typing import Optional
  2. from datetime import datetime
  3.  
  4. from pydantic import BaseModel, ConfigDict
  5.  
  6. from app.models.constants import InventoryTimelineType
  7. from app.schemas.inventory import InventoryProduct
  8.  
  9.  
  10. # Shared properties
  11. class InventoryTimelineBase(BaseModel):
  12. inventory_id: Optional[int] = None
  13. store_id: Optional[int] = None
  14. added_on: Optional[datetime] = None
  15. updated_on: Optional[datetime] = None
  16. source: Optional[str] = None
  17. category: Optional[int] = None
  18. changed_value: Optional[float] = None
  19. change_type: Optional[InventoryTimelineType] = None
  20. info: Optional[dict] = None
  21.  
  22.  
  23. class InventoryTimelineCreate(InventoryTimelineBase):
  24. inventory_id: int
  25.  
  26.  
  27. class InventoryTimeline(InventoryTimelineBase):
  28. inventory: Optional[InventoryProduct] = None
  29.  
  30.  
  31. # Properties shared by models stored in DB
  32. class InventoryTimelineInDBBase(InventoryTimelineBase):
  33. model_config = ConfigDict(from_attributes=True)
  34. id: int
  35.  
  36.  
  37. class InventoryTimelineUpdate(InventoryTimelineBase):
  38. source: Optional[str] = None
  39. category: Optional[int] = None
  40. changed_value: Optional[float] = None
  41. change_type: Optional[InventoryTimelineType] = None
  42. info: Optional[dict] = None
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement