Phase 2.2: Update AIEngine for token-based billing + GlobalModuleSettings
This commit is contained in:
62
backend/igny8_core/modules/system/global_settings_models.py
Normal file
62
backend/igny8_core/modules/system/global_settings_models.py
Normal file
@@ -0,0 +1,62 @@
|
||||
"""
|
||||
Global Module Settings - Platform-wide module enable/disable
|
||||
Singleton model for system-wide control
|
||||
"""
|
||||
from django.db import models
|
||||
|
||||
|
||||
class GlobalModuleSettings(models.Model):
|
||||
"""
|
||||
Global module enable/disable settings (platform-wide).
|
||||
|
||||
Singleton model - only one record exists (pk=1).
|
||||
Controls which modules are available across the entire platform.
|
||||
No per-account overrides allowed - this is admin-only control.
|
||||
"""
|
||||
planner_enabled = models.BooleanField(
|
||||
default=True,
|
||||
help_text="Enable Planner module platform-wide"
|
||||
)
|
||||
writer_enabled = models.BooleanField(
|
||||
default=True,
|
||||
help_text="Enable Writer module platform-wide"
|
||||
)
|
||||
thinker_enabled = models.BooleanField(
|
||||
default=True,
|
||||
help_text="Enable Thinker module platform-wide"
|
||||
)
|
||||
automation_enabled = models.BooleanField(
|
||||
default=True,
|
||||
help_text="Enable Automation module platform-wide"
|
||||
)
|
||||
site_builder_enabled = models.BooleanField(
|
||||
default=True,
|
||||
help_text="Enable Site Builder module platform-wide"
|
||||
)
|
||||
linker_enabled = models.BooleanField(
|
||||
default=True,
|
||||
help_text="Enable Linker module platform-wide"
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = "Global Module Settings"
|
||||
verbose_name_plural = "Global Module Settings"
|
||||
db_table = "igny8_global_module_settings"
|
||||
|
||||
def __str__(self):
|
||||
return "Global Module Settings"
|
||||
|
||||
@classmethod
|
||||
def get_settings(cls):
|
||||
"""Get or create singleton instance"""
|
||||
obj, created = cls.objects.get_or_create(pk=1)
|
||||
return obj
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""Enforce singleton pattern"""
|
||||
self.pk = 1
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
"""Prevent deletion"""
|
||||
pass
|
||||
@@ -0,0 +1,30 @@
|
||||
# Generated by Django on 2025-12-23
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('system', '0002_add_model_fk_to_integrations'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='GlobalModuleSettings',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('planner_enabled', models.BooleanField(default=True, help_text='Enable Planner module platform-wide')),
|
||||
('writer_enabled', models.BooleanField(default=True, help_text='Enable Writer module platform-wide')),
|
||||
('thinker_enabled', models.BooleanField(default=True, help_text='Enable Thinker module platform-wide')),
|
||||
('automation_enabled', models.BooleanField(default=True, help_text='Enable Automation module platform-wide')),
|
||||
('site_builder_enabled', models.BooleanField(default=True, help_text='Enable Site Builder module platform-wide')),
|
||||
('linker_enabled', models.BooleanField(default=True, help_text='Enable Linker module platform-wide')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Global Module Settings',
|
||||
'verbose_name_plural': 'Global Module Settings',
|
||||
'db_table': 'igny8_global_module_settings',
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user