adjust citysite table name to activesites

This commit is contained in:
Alberto-Audrix committed 2026-09-11 15:51:29 +07:00
1 parent fb0f996776
commit 64b37b6b6d
27 files changed
+382 -221

No files matched your search

+8 -8
View File
@@ -4,33 +4,33 @@ from django.conf import settings
from django.db import models
class CitySite(models.Model):
class ActiveSite(models.Model):
"""
Registry of a city dashboard-cpsp deployment that HQ can mirror from.
Registry of a farm-location dashboard-cpsp deployment that HQ can mirror from.
Outbound API key is stored here for local/dev scaffolding. Prefer a secret
manager or encrypted field before production.
"""
city_site_id = models.BigAutoField(primary_key=True)
active_site_id = models.BigAutoField(primary_key=True)
code = models.SlugField(max_length=64, unique=True, help_text="Stable id, e.g. sukawarna")
name = models.CharField(max_length=120)
api_base_url = models.URLField(
max_length=255,
help_text="City API root including /api/v1, e.g. https://site.example/api/v1",
help_text="Site API root including /api/v1, e.g. https://site.example/api/v1",
)
api_key = models.CharField(
max_length=255,
blank=True,
help_text="X-API-Key for pulling from the city API (keep server-side only)",
help_text="X-API-Key for pulling from the site API (keep server-side only)",
)
registered_by = models.ForeignKey(
settings.AUTH_USER_MODEL,
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="registered_city_sites",
help_text="GM / GM Admin who added this city dashboard URL",
related_name="registered_active_sites",
help_text="GM / GM Admin who added this site dashboard URL",
)
is_active = models.BooleanField(default=True)
last_synced_at = models.DateTimeField(null=True, blank=True)
@@ -40,7 +40,7 @@ class CitySite(models.Model):
updated_at = models.DateTimeField(auto_now=True)
class Meta:
db_table = "city_sites"
db_table = "active_sites"
ordering = ["name"]
def __str__(self) -> str: