Files
plugins/openedx-tenant-api/openedx_tenant_api/models.py
DamarKusumo 2b7027e37d Add openedx-tenant-api plugin
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-10 08:20:57 +07:00

26 lines
891 B
Python

from django.db import models
from django.contrib.auth.models import User
class TenantProvisioningLog(models.Model):
"""Audit log for tenant creation via API."""
tenant_name = models.CharField(max_length=255, db_index=True)
external_key = models.CharField(max_length=255)
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
status = models.CharField(max_length=50, choices=[
('success', 'Success'),
('failed', 'Failed'),
])
error_message = models.TextField(blank=True)
tenant_config_id = models.IntegerField(null=True, blank=True)
class Meta:
ordering = ['-created_at']
indexes = [
models.Index(fields=['tenant_name', 'created_at']),
]
def __str__(self):
return f"{self.tenant_name} - {self.status} - {self.created_at}"