Merge pull request 'fix' (#25) from pre-dev into dev
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good

Reviewed-on: #25
This commit was merged in pull request #25.
This commit is contained in:
2026-04-14 23:02:44 +00:00
3 changed files with 38 additions and 2 deletions

1
.gitignore vendored
View File

@@ -10,7 +10,6 @@ deployments/docker-compose.yml
postgres_data/ postgres_data/
local_postgres_data/ local_postgres_data/
*.pyc *.pyc
apps/backend_admin/migrations/0001_initial.py
# Bloquear todos los .env en cualquier carpeta # Bloquear todos los .env en cualquier carpeta
.env .env
**/core/.env **/core/.env

View File

@@ -0,0 +1,36 @@
# Generated by Django 5.0.3 on 2026-04-14 22:57
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Log',
fields=[
('id', models.BigAutoField(primary_key=True, serialize=False)),
('user_id', models.IntegerField(default=0)),
('user', models.CharField(default='anonimo', max_length=255)),
('app_id', models.IntegerField(default=0)),
('remote_address', models.GenericIPAddressField(blank=True, null=True)),
('request', models.JSONField(blank=True, null=True)),
('response', models.JSONField(blank=True, null=True)),
('status_code', models.CharField(default='0', max_length=10)),
('path', models.CharField(max_length=255)),
('method', models.CharField(max_length=10)),
('createdAt', models.DateTimeField(default=django.utils.timezone.now)),
('updatedAt', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'audit_logs',
'managed': False,
},
),
]

View File

@@ -17,9 +17,10 @@ class Log(models.Model):
createdAt = models.DateTimeField(default=timezone.now) createdAt = models.DateTimeField(default=timezone.now)
updatedAt = models.DateTimeField(auto_now=True) updatedAt = models.DateTimeField(auto_now=True)
class Meta: class Meta:
db_table = 'audit_logs' db_table = 'audit_logs'
managed = False # Al estar la tabla ya creada, Django no intentará modificarla # managed = True <-- Asegúrate de que no esté en False
def __str__(self): def __str__(self):
return f"{self.method} {self.path} ({self.status_code})" return f"{self.method} {self.path} ({self.status_code})"