diff --git a/app/models/stock_movement.py b/app/models/stock_movement.py new file mode 100644 index 0000000..0ecbee6 --- /dev/null +++ b/app/models/stock_movement.py @@ -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)