|
|
@@ -46,6 +46,9 @@ ESQUEMA DE BASE DE DATOS SQLITE (data.db)
|
|
|
- price INTEGER NOT NULL
|
|
|
- image TEXT (URL de la imagen)
|
|
|
- status INTEGER DEFAULT 1 NOT NULL CHECK (status IN (0, 1)) -- 0: Inactivo, 1: Activo
|
|
|
+- promo_id INTEGER (ID de la promoción asociada, si existe)
|
|
|
+- promo_price INTEGER (Precio promocional, si existe)
|
|
|
+- promo_day INTEGER (Día de la semana para la promoción, 1-7)
|
|
|
(Guarda los productos disponibles para venta con su estado activo/inactivo)
|
|
|
|
|
|
3. Tabla: sales
|
|
|
@@ -561,7 +564,11 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
+
|
|
|
) for product in products
|
|
|
]
|
|
|
|
|
|
@@ -580,7 +587,10 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
)
|
|
|
return None
|
|
|
|
|
|
@@ -599,7 +609,10 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
) for product in products
|
|
|
]
|
|
|
|
|
|
@@ -618,7 +631,10 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
) for product in products
|
|
|
]
|
|
|
|
|
|
@@ -640,7 +656,10 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
) for product in products
|
|
|
]
|
|
|
#endregion
|
|
|
@@ -727,7 +746,10 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
) for product in products
|
|
|
]
|
|
|
|
|
|
@@ -746,7 +768,10 @@ class ProductDataService(BaseDataService):
|
|
|
description=product[3],
|
|
|
price=product[4],
|
|
|
image=product[5],
|
|
|
- status=product[6]
|
|
|
+ status=product[6],
|
|
|
+ promo_id=product[7],
|
|
|
+ promo_price=product[8],
|
|
|
+ promo_day=product[9]
|
|
|
) for product in products
|
|
|
]
|
|
|
|
|
|
@@ -1299,7 +1324,10 @@ def initialize_db():
|
|
|
description TEXT NOT NULL,
|
|
|
price INTEGER NOT NULL,
|
|
|
image TEXT,
|
|
|
- status INTEGER DEFAULT 1 NOT NULL CHECK (status IN (0, 1)) -- 0: Inactivo, 1: Activo
|
|
|
+ status INTEGER DEFAULT 1 NOT NULL CHECK (status IN (0, 1)) -- 0: Inactivo, 1: Activo,
|
|
|
+ promo_id INTEGER,
|
|
|
+ promo_price INTEGER,
|
|
|
+ promo_day INTEGER CHECK (promo_day >= 1 AND promo_day <= 7)
|
|
|
);
|
|
|
""")
|
|
|
|