Add app/models/stock_movement.py
This commit is contained in:
22
app/models/stock_movement.py
Normal file
22
app/models/stock_movement.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
|
from sqlalchemy import Column, String, DateTime, Integer, Enum, ForeignKey
|
||||||
|
from app.database import Base
|
||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
class MovementType(str, enum.Enum):
|
||||||
|
IN = "IN"
|
||||||
|
OUT = "OUT"
|
||||||
|
ADJUST = "ADJUST"
|
||||||
|
|
||||||
|
|
||||||
|
class StockMovement(Base):
|
||||||
|
__tablename__ = "stock_movements"
|
||||||
|
|
||||||
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||||
|
product_id = Column(String(36), ForeignKey("products.id"), nullable=False)
|
||||||
|
type = Column(Enum(MovementType), nullable=False)
|
||||||
|
quantity = Column(Integer, nullable=False)
|
||||||
|
reason = Column(String(200), nullable=True)
|
||||||
|
created_at = Column(DateTime, default=datetime.utcnow)
|
||||||
Reference in New Issue
Block a user