From b62eb5b70aaa98f1ccb5883dce93c667a2444c41 Mon Sep 17 00:00:00 2001 From: openclaw Date: Sat, 11 Apr 2026 03:58:32 +0000 Subject: [PATCH] Add app/models/stock_movement.py --- app/models/stock_movement.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/models/stock_movement.py 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)