Compare commits

7 Commits

Author SHA1 Message Date
minguezsanzjuanjose
1a53cd3918 feat: add postrequest script to save access_token in active environment
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:25:24 +02:00
minguezsanzjuanjose
35e1d38859 fix: use native Postman auth field and declare collection variables
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:11:39 +02:00
minguezsanzjuanjose
a064895689 fix: add missing initial migration for promociones app
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:53:14 +02:00
minguezsanzjuanjose
05e95f8880 chore: remove legacy postman_environments.json (replaced by environments/ folder)
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:43:35 +02:00
minguezsanzjuanjose
af38d88876 fix: add Postman-compatible environment files (split by env, correct format)
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:35:57 +02:00
minguezsanzjuanjose
02fa6247f1 fix: replace external saas_network with named network to auto-create on compose up
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:27:06 +02:00
minguezsanzjuanjose
428b745700 chore: add Makefile to auto-create saas_network before docker compose up
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:25:18 +02:00
8 changed files with 122 additions and 45 deletions

View File

@@ -0,0 +1,26 @@
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name='Promocion',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombre', models.CharField(max_length=255)),
('fecha_inicio', models.DateField(blank=True, null=True)),
('fecha_modificacion', models.DateField(blank=True, null=True)),
('descripcion', models.TextField(blank=True, null=True)),
('activo', models.BooleanField(default=True)),
('categoria_id', models.IntegerField(blank=True, null=True)),
],
options={
'db_table': 'promociones',
},
),
]

15
deployments/Makefile Normal file
View File

@@ -0,0 +1,15 @@
NETWORK = saas_network
.PHONY: network up down logs
network:
docker network inspect $(NETWORK) >/dev/null 2>&1 || docker network create $(NETWORK)
up: network
docker compose up --build -d
down:
docker compose down
logs:
docker compose logs -f

View File

@@ -45,4 +45,4 @@ volumes:
networks: networks:
saas_network: saas_network:
external: true name: saas_network

View File

@@ -0,0 +1,11 @@
{
"id": "x8jh10qysfo",
"name": "DEV",
"values": [
{ "key": "base_url", "value": "https://dev.v-encore-lab.com", "type": "default", "enabled": true },
{ "key": "username", "value": "admin", "type": "default", "enabled": true },
{ "key": "password", "value": "admin", "type": "default", "enabled": true },
{ "key": "access_token", "value": "", "type": "default", "enabled": true }
],
"_postman_variable_scope": "environment"
}

View File

@@ -0,0 +1,11 @@
{
"id": "ftt19d5vxuj",
"name": "LOCAL",
"values": [
{ "key": "base_url", "value": "http://localhost:8000", "type": "default", "enabled": true },
{ "key": "username", "value": "admin", "type": "default", "enabled": true },
{ "key": "password", "value": "admin", "type": "default", "enabled": true },
{ "key": "access_token", "value": "", "type": "default", "enabled": true }
],
"_postman_variable_scope": "environment"
}

View File

@@ -0,0 +1,11 @@
{
"id": "3ckrklvkf27",
"name": "PROD",
"values": [
{ "key": "base_url", "value": "https://v-encore-lab.com", "type": "default", "enabled": true },
{ "key": "username", "value": "admin", "type": "default", "enabled": true },
{ "key": "password", "value": "admin", "type": "default", "enabled": true },
{ "key": "access_token", "value": "", "type": "default", "enabled": true }
],
"_postman_variable_scope": "environment"
}

View File

@@ -5,7 +5,10 @@
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_postman_id": "django-core-base-collection" "_postman_id": "django-core-base-collection"
}, },
"variable": [], "variable": [
{ "key": "access_token", "value": "", "type": "string" },
{ "key": "refresh_token", "value": "", "type": "string" }
],
"item": [ "item": [
{ {
"name": "Auth", "name": "Auth",
@@ -25,6 +28,29 @@
"}" "}"
] ]
} }
},
{
"listen": "postrequest",
"script": {
"type": "text/javascript",
"exec": [
"// Comprobamos si la respuesta es exitosa",
"if (pw.response.status === 200) {",
" // Si el body ya es un objeto no hace falta JSON.parse",
" const body = typeof pw.response.body === 'string'",
" ? JSON.parse(pw.response.body)",
" : pw.response.body;",
"",
" if (body.access) {",
" // Guardamos el token en el entorno actual",
" pw.env.set(\"access_token\", body.access);",
" console.log(\"✅ Token guardado correctamente\");",
" } else {",
" console.log(\"❌ No se encontró el campo 'access' en la respuesta\");",
" }",
"}"
]
}
} }
], ],
"request": { "request": {
@@ -51,10 +77,13 @@
{ {
"name": "Obtener Promoción", "name": "Obtener Promoción",
"request": { "request": {
"auth": {
"type": "bearer",
"bearer": [{ "key": "token", "value": "{{access_token}}", "type": "string" }]
},
"method": "POST", "method": "POST",
"header": [ "header": [
{ "key": "Content-Type", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }
{ "key": "Authorization", "value": "Bearer {{access_token}}" }
], ],
"body": { "body": {
"mode": "raw", "mode": "raw",
@@ -75,10 +104,13 @@
{ {
"name": "Ejecutar Automatizaciones", "name": "Ejecutar Automatizaciones",
"request": { "request": {
"auth": {
"type": "bearer",
"bearer": [{ "key": "token", "value": "{{access_token}}", "type": "string" }]
},
"method": "POST", "method": "POST",
"header": [ "header": [
{ "key": "Content-Type", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }
{ "key": "Authorization", "value": "Bearer {{access_token}}" }
], ],
"body": { "body": {
"mode": "raw", "mode": "raw",
@@ -94,10 +126,13 @@
{ {
"name": "Historial de Ejecuciones", "name": "Historial de Ejecuciones",
"request": { "request": {
"auth": {
"type": "bearer",
"bearer": [{ "key": "token", "value": "{{access_token}}", "type": "string" }]
},
"method": "POST", "method": "POST",
"header": [ "header": [
{ "key": "Content-Type", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }
{ "key": "Authorization", "value": "Bearer {{access_token}}" }
], ],
"body": { "body": {
"mode": "raw", "mode": "raw",
@@ -113,10 +148,13 @@
{ {
"name": "Estado del Módulo", "name": "Estado del Módulo",
"request": { "request": {
"auth": {
"type": "bearer",
"bearer": [{ "key": "token", "value": "{{access_token}}", "type": "string" }]
},
"method": "POST", "method": "POST",
"header": [ "header": [
{ "key": "Content-Type", "value": "application/json" }, { "key": "Content-Type", "value": "application/json" }
{ "key": "Authorization", "value": "Bearer {{access_token}}" }
], ],
"body": { "body": {
"mode": "raw", "mode": "raw",

View File

@@ -1,35 +0,0 @@
{
"local": {
"id": "ftt19d5vxuj",
"v": 2,
"name": "LOCAL",
"variables": [
{ "key": "base_url", "secret": false, "initialValue": "http://localhost:8000", "currentValue": "http://localhost:8000" },
{ "key": "username", "secret": false, "initialValue": "admin", "currentValue": "admin" },
{ "key": "password", "secret": false, "initialValue": "admin", "currentValue": "admin" },
{ "key": "access_token", "secret": false, "initialValue": "", "currentValue": "" }
]
},
"dev": {
"id": "x8jh10qysfo",
"v": 2,
"name": "DEV",
"variables": [
{ "key": "base_url", "secret": false, "initialValue": "https://dev.v-encore-lab.com", "currentValue": "https://dev.v-encore-lab.com" },
{ "key": "username", "secret": false, "initialValue": "admin", "currentValue": "admin" },
{ "key": "password", "secret": false, "initialValue": "admin", "currentValue": "admin" },
{ "key": "access_token", "secret": false, "initialValue": "", "currentValue": "" }
]
},
"prod": {
"id": "3ckrklvkf27",
"v": 2,
"name": "PROD",
"variables": [
{ "key": "base_url", "secret": false, "initialValue": "https://v-encore-lab.com", "currentValue": "https://v-encore-lab.com" },
{ "key": "username", "secret": false, "initialValue": "admin", "currentValue": "admin" },
{ "key": "password", "secret": false, "initialValue": "admin", "currentValue": "admin" },
{ "key": "access_token", "secret": false, "initialValue": "", "currentValue": "" }
]
}
}