diff --git a/.gitignore b/.gitignore index e3b2dd4..1abf015 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ venv/ .venv # Archivos de base de datos +db.sqlite3 # Archivos de migraciones (si quieres omitirlos) **/migrations/__pycache__/ @@ -21,4 +22,5 @@ venv/ # Archivos de Django estáticos staticfiles/ -**/*.sqlite3 \ No newline at end of file +# Archivos subidos por el usuario +media/ \ No newline at end of file diff --git a/essenza/_sample_assets/products/maquillaje_base.jpg b/essenza/_sample_assets/products/maquillaje_base.jpg new file mode 100644 index 0000000..e8be144 Binary files /dev/null and b/essenza/_sample_assets/products/maquillaje_base.jpg differ diff --git a/essenza/media/profile_pics/admin.png b/essenza/_sample_assets/profile_pics/admin.png similarity index 100% rename from essenza/media/profile_pics/admin.png rename to essenza/_sample_assets/profile_pics/admin.png diff --git a/essenza/media/profile_pics/ana_martin.jpg b/essenza/_sample_assets/profile_pics/ana_martin.jpg similarity index 100% rename from essenza/media/profile_pics/ana_martin.jpg rename to essenza/_sample_assets/profile_pics/ana_martin.jpg diff --git a/essenza/media/profile_pics/carla_gonzalez.jpg b/essenza/_sample_assets/profile_pics/carla_gonzalez.jpg similarity index 100% rename from essenza/media/profile_pics/carla_gonzalez.jpg rename to essenza/_sample_assets/profile_pics/carla_gonzalez.jpg diff --git a/essenza/media/profile_pics/juan_perez.jpg b/essenza/_sample_assets/profile_pics/juan_perez.jpg similarity index 100% rename from essenza/media/profile_pics/juan_perez.jpg rename to essenza/_sample_assets/profile_pics/juan_perez.jpg diff --git a/essenza/db.sqlite3 b/essenza/db.sqlite3 deleted file mode 100644 index 28442db..0000000 Binary files a/essenza/db.sqlite3 and /dev/null differ diff --git a/essenza/load_samples.bat b/essenza/load_samples.bat new file mode 100644 index 0000000..8374cf9 --- /dev/null +++ b/essenza/load_samples.bat @@ -0,0 +1,48 @@ +@echo off +REM --------------------------------------------------------- +REM IMPORTANTE: Este archivo borra todos los datos de tu BD local (y la crea con los datos de sampleo). +REM Las imágenes de sampleo se copian a la carpeta 'media/'. +REM También instala las dependencias necesarias definidas en 'requirements.txt' (si aun no lo están). +REM --------------------------------------------------------- + +echo --- Instalando dependencias (pip)... +pip install -r requirements.txt && ( + + echo --- Borrando TODOS los datos de la BD... + python manage.py flush --noinput && ( + + echo. + echo --- Aplicando migraciones... + python manage.py migrate --noinput && ( + + echo. + echo --- Copiando imagenes de sampleo a 'media/'... + REM XCOPY [origen] [destino] /E /I /Y + REM /E = Copia subdirectorios (incluso vacíos) + REM /I = Si el destino no existe, asume que es un directorio + REM /Y = Suprime la pregunta de "sobreescribir archivo" + XCOPY _sample_assets media /E /I /Y && ( + + echo. + echo --- Cargando datos de USER... + python manage.py loaddata user/sample/sample.json && ( + + echo. + echo --- Cargando datos de PRODUCT... + python manage.py loaddata product/sample/sample.json && ( + + echo. + echo --- Cargando datos de ORDER... + python manage.py loaddata order/sample/sample.json && ( + + echo. + echo --- !Proceso completado! La base de datos esta lista. --- + ) + ) + ) + ) + ) + ) +) + +@echo on \ No newline at end of file diff --git a/essenza/order/sample/sample.json b/essenza/order/sample/sample.json index 58bcedd..fc7017d 100644 --- a/essenza/order/sample/sample.json +++ b/essenza/order/sample/sample.json @@ -5,7 +5,7 @@ "fields": { "user": 1, "address": "Calle Gran Vía, 23, Madrid, 28013", - "placed_at": "2024-02-12T10:45:00Z", + "placed_at": "2025-11-12T10:30:00Z", "status": "pending" } }, @@ -15,7 +15,7 @@ "fields": { "user": 2, "address": "Avenida de la Constitución, 8, Sevilla, 41001", - "placed_at": "2024-03-01T15:10:00Z", + "placed_at": "2025-11-11T15:10:00Z", "status": "paid" } }, @@ -25,7 +25,7 @@ "fields": { "user": 3, "address": "Carrer de Pau Claris, 60, Barcelona, 08010", - "placed_at": "2024-03-20T19:25:00Z", + "placed_at": "2025-11-10T19:25:00Z", "status": "shipped" } }, @@ -35,7 +35,7 @@ "fields": { "user": 1, "address": "Calle Alcalá, 120, Madrid, 28009", - "placed_at": "2024-04-05T09:00:00Z", + "placed_at": "2025-11-09T09:00:00Z", "status": "pending" } }, @@ -45,17 +45,67 @@ "fields": { "user": 2, "address": "Plaza Nueva, 10, Bilbao, 48001", - "placed_at": "2024-04-22T12:15:00Z", + "placed_at": "2025-11-08T12:15:00Z", "status": "shipped" } }, + { + "model": "order.order", + "pk": 6, + "fields": { + "user": 3, + "address": "Calle Larios, 5, Málaga, 29001", + "placed_at": "2025-11-07T14:00:00Z", + "status": "paid" + } + }, + { + "model": "order.order", + "pk": 7, + "fields": { + "user": 1, + "address": "Paseo de Gracia, 92, Barcelona, 08008", + "placed_at": "2025-11-06T18:45:00Z", + "status": "pending" + } + }, + { + "model": "order.order", + "pk": 8, + "fields": { + "user": 2, + "address": "Calle de la Paz, 1, Valencia, 46003", + "placed_at": "2025-11-06T10:00:00Z", + "status": "shipped" + } + }, + { + "model": "order.order", + "pk": 9, + "fields": { + "user": 3, + "address": "Calle Mayor, 30, Zaragoza, 50001", + "placed_at": "2025-10-15T11:00:00Z", + "status": "shipped" + } + }, + { + "model": "order.order", + "pk": 10, + "fields": { + "user": 1, + "address": "Rúa do Vilar, 50, Santiago de Compostela, 15705", + "placed_at": "2025-10-28T08:30:00Z", + "status": "paid" + } + }, { "model": "order.orderproduct", "pk": 1, "fields": { "order": 1, "product": 1, - "quantity": 2 + "quantity": 1 } }, { @@ -64,7 +114,7 @@ "fields": { "order": 1, "product": 18, - "quantity": 1 + "quantity": 2 } }, { @@ -72,17 +122,17 @@ "pk": 3, "fields": { "order": 2, - "product": 5, - "quantity": 3 + "product": 2, + "quantity": 2 } }, { "model": "order.orderproduct", "pk": 4, "fields": { - "order": 2, - "product": 14, - "quantity": 2 + "order": 3, + "product": 5, + "quantity": 1 } }, { @@ -90,7 +140,7 @@ "pk": 5, "fields": { "order": 3, - "product": 3, + "product": 11, "quantity": 1 } }, @@ -99,16 +149,16 @@ "pk": 6, "fields": { "order": 3, - "product": 9, - "quantity": 2 + "product": 15, + "quantity": 1 } }, { "model": "order.orderproduct", "pk": 7, "fields": { - "order": 3, - "product": 10, + "order": 4, + "product": 4, "quantity": 1 } }, @@ -116,17 +166,17 @@ "model": "order.orderproduct", "pk": 8, "fields": { - "order": 4, - "product": 11, - "quantity": 2 + "order": 5, + "product": 8, + "quantity": 1 } }, { "model": "order.orderproduct", "pk": 9, "fields": { - "order": 4, - "product": 15, + "order": 6, + "product": 3, "quantity": 1 } }, @@ -134,18 +184,189 @@ "model": "order.orderproduct", "pk": 10, "fields": { - "order": 5, - "product": 7, - "quantity": 4 + "order": 6, + "product": 6, + "quantity": 1 } }, { "model": "order.orderproduct", "pk": 11, "fields": { - "order": 5, + "order": 7, + "product": 10, + "quantity": 2 + } + }, + { + "model": "order.orderproduct", + "pk": 12, + "fields": { + "order": 8, "product": 20, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 13, + "fields": { + "order": 8, + "product": 17, + "quantity": 3 + } + }, + { + "model": "order.orderproduct", + "pk": 14, + "fields": { + "order": 9, + "product": 9, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 15, + "fields": { + "order": 9, + "product": 12, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 16, + "fields": { + "order": 10, + "product": 7, + "quantity": 5 + } + }, + { + "model": "order.orderproduct", + "pk": 17, + "fields": { + "order": 10, + "product": 16, + "quantity": 2 + } + }, + { + "model": "order.orderproduct", + "pk": 18, + "fields": { + "order": 1, + "product": 10, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 19, + "fields": { + "order": 2, + "product": 7, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 20, + "fields": { + "order": 4, + "product": 2, + "quantity": 3 + } + }, + { + "model": "order.orderproduct", + "pk": 21, + "fields": { + "order": 5, + "product": 19, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 22, + "fields": { + "order": 7, + "product": 1, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 23, + "fields": { + "order": 7, + "product": 18, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 24, + "fields": { + "order": 9, + "product": 5, + "quantity": 2 + } + }, + { + "model": "order.orderproduct", + "pk": 25, + "fields": { + "order": 9, + "product": 14, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 26, + "fields": { + "order": 10, + "product": 8, "quantity": 2 } + }, + { + "model": "order.orderproduct", + "pk": 27, + "fields": { + "order": 1, + "product": 4, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 28, + "fields": { + "order": 3, + "product": 6, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 29, + "fields": { + "order": 8, + "product": 13, + "quantity": 1 + } + }, + { + "model": "order.orderproduct", + "pk": 30, + "fields": { + "order": 2, + "product": 3, + "quantity": 1 + } } -] +] \ No newline at end of file