Add plugin platform with modular backend and frontend registry.

Split graph/import/meta into Django apps, add API v1 with OpenAPI and pytest, and introduce plugin registry with the tags reference plugin on both FE and BE.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-25 09:35:51 +03:00
co-authored by Cursor
parent b694a596b8
commit cafc7335ad
77 changed files with 1801 additions and 490 deletions
+33 -2
View File
@@ -12,13 +12,25 @@ ALLOWED_HOSTS = [
h.strip() for h in os.environ.get('ALLOWED_HOSTS', '*').split(',') if h.strip()
]
ENABLED_PLUGINS = [
p.strip()
for p in os.environ.get('ENABLED_PLUGINS', 'tags').split(',')
if p.strip()
]
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.auth',
'django.contrib.staticfiles',
'rest_framework',
'corsheaders',
'drf_spectacular',
'core',
'contacts',
'graph',
'import_export',
'plugins',
'plugins_tags',
]
MIDDLEWARE = [
@@ -41,11 +53,30 @@ STATIC_ROOT = BASE_DIR / 'staticfiles'
REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 100,
'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',
}
SPECTACULAR_SETTINGS = {
'TITLE': 'Social Graph API',
'DESCRIPTION': 'API for Social Graph Builder (local-first with optional remote backend)',
'VERSION': '1.0.0',
}
CORS_ALLOW_ALL_ORIGINS = True
# Лимит тела запроса для импорта больших JSON (например, экспорт Monica с сотнями контактов)
DATA_UPLOAD_MAX_MEMORY_SIZE = 20 * 1024 * 1024 # 20 MB
DATA_UPLOAD_MAX_MEMORY_SIZE = 20 * 1024 * 1024
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Phase C: optional JWT auth (disabled by default)
USE_JWT_AUTH = os.environ.get('USE_JWT_AUTH', 'false').lower() in ('1', 'true', 'yes')
if USE_JWT_AUTH:
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = [
'rest_framework_simplejwt.authentication.JWTAuthentication',
]
REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] = [
'rest_framework.permissions.IsAuthenticated',
]
DEFAULT_WORKSPACE_ID = os.environ.get('DEFAULT_WORKSPACE_ID', 'personal')
+5
View File
@@ -1,5 +1,10 @@
from django.urls import path, include
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
urlpatterns = [
path('api/v1/', include('api.v1.urls')),
path('api/', include('contacts.urls')),
path('api/v1/schema/', SpectacularAPIView.as_view(), name='schema'),
path('api/v1/docs/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('api/v1/', include('core.auth_urls')),
]