57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""
|
|
JSON Schemas for Settings Validation
|
|
"""
|
|
SETTINGS_SCHEMAS = {
|
|
'table_settings': {
|
|
"type": "object",
|
|
"properties": {
|
|
"records_per_page": {"type": "integer", "minimum": 5, "maximum": 100},
|
|
"default_sort": {"type": "string"},
|
|
"default_sort_direction": {"type": "string", "enum": ["asc", "desc"]}
|
|
},
|
|
"required": ["records_per_page"]
|
|
},
|
|
'planner_automation': {
|
|
"type": "object",
|
|
"properties": {
|
|
"auto_cluster_enabled": {"type": "boolean"},
|
|
"auto_ideas_enabled": {"type": "boolean"},
|
|
"max_keywords_per_cluster": {"type": "integer", "minimum": 1, "maximum": 50}
|
|
}
|
|
},
|
|
'writer_automation': {
|
|
"type": "object",
|
|
"properties": {
|
|
"auto_generate_content_enabled": {"type": "boolean"},
|
|
"auto_generate_images_enabled": {"type": "boolean"},
|
|
"auto_publish_enabled": {"type": "boolean"}
|
|
}
|
|
},
|
|
'ai_settings': {
|
|
"type": "object",
|
|
"properties": {
|
|
"default_model": {"type": "string"},
|
|
"temperature": {"type": "number", "minimum": 0, "maximum": 2},
|
|
"max_tokens": {"type": "integer", "minimum": 1, "maximum": 32000}
|
|
}
|
|
},
|
|
'user_preferences': {
|
|
"type": "object",
|
|
"properties": {
|
|
"theme": {"type": "string", "enum": ["light", "dark", "auto"]},
|
|
"language": {"type": "string"},
|
|
"notifications_enabled": {"type": "boolean"}
|
|
}
|
|
}
|
|
}
|
|
|
|
# Map settings keys to their schemas
|
|
SETTINGS_KEY_SCHEMA_MAP = {
|
|
'table_settings': 'table_settings',
|
|
'planner_automation': 'planner_automation',
|
|
'writer_automation': 'writer_automation',
|
|
'ai_settings': 'ai_settings',
|
|
'user_preferences': 'user_preferences',
|
|
}
|
|
|