update api export for executive and fixing closing cycle flow

This commit is contained in:
Alberto-Audrix committed 2026-09-15 16:53:25 +07:00
1 parent d0d1ae7d24
commit 07d36081ce
23 files changed
+1378 -101

No files matched your search

@@ -109,13 +109,13 @@ class Command(BaseCommand):
stdout=self.stdout,
)
bootstrap_key = settings.BOOTSTRAP_API_KEY
bootstrap_key = settings.SITE_API_KEY
if bootstrap_key:
api_key, _ = ApiKey.generate(admin, "bootstrap")
api_key, _ = ApiKey.generate(admin, "site")
api_key.prefix = bootstrap_key[:8]
api_key.key_hash = ApiKey.hash_key(bootstrap_key)
api_key.save(update_fields=["prefix", "key_hash", "updated_at"])
self.stdout.write(f"Bootstrap API key installed (prefix={api_key.prefix})")
self.stdout.write(f"Site API key installed (prefix={api_key.prefix})")
accounts = admin_user_name
if staff_user_name:
@@ -35,14 +35,14 @@ class Command(BaseCommand):
user.save(update_fields=["display_name", "updated_at"])
raw_key = None
bootstrap = settings.BOOTSTRAP_API_KEY
bootstrap = settings.SITE_API_KEY
if bootstrap:
api_key, raw_key = ApiKey.generate(user, "bootstrap")
api_key, raw_key = ApiKey.generate(user, "site")
api_key.prefix = bootstrap[:8]
api_key.key_hash = ApiKey.hash_key(bootstrap)
api_key.save(update_fields=["prefix", "key_hash", "updated_at"])
raw_key = bootstrap
self.stdout.write(f"Bootstrap API key installed (prefix={api_key.prefix})")
self.stdout.write(f"Site API key installed (prefix={api_key.prefix})")
elif not ApiKey.objects.filter(user=user).exists():
api_key, raw_key = ApiKey.generate(user, "seed")
self.stdout.write(self.style.WARNING(f"Demo API key (save now): {raw_key}"))