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:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CoreConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'core'
|
||||
@@ -0,0 +1,15 @@
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = []
|
||||
|
||||
try:
|
||||
from django.conf import settings
|
||||
if getattr(settings, 'USE_JWT_AUTH', False):
|
||||
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
|
||||
|
||||
urlpatterns = [
|
||||
path('auth/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||
path('auth/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
|
||||
]
|
||||
except ImportError:
|
||||
pass
|
||||
@@ -0,0 +1,40 @@
|
||||
"""Shared domain choice constants for API meta and models."""
|
||||
|
||||
LIFE_SPHERES = [
|
||||
('work', 'Работа'),
|
||||
('study', 'Учёба'),
|
||||
('hobby', 'Хобби'),
|
||||
('family', 'Семья'),
|
||||
('health', 'Здоровье'),
|
||||
('other', 'Другое'),
|
||||
]
|
||||
|
||||
NETWORK_CIRCLES = [
|
||||
('support', 'Круг поддержки'),
|
||||
('productivity', 'Круг продуктивности'),
|
||||
('development', 'Круг развития'),
|
||||
]
|
||||
|
||||
INTERACTION_INTENSITY = [
|
||||
('intense', 'Интенсивные контакты'),
|
||||
('periodic', 'Периодические контакты'),
|
||||
('sparse', 'Редкие контакты'),
|
||||
]
|
||||
|
||||
RELATION_TYPES = [
|
||||
('colleague', 'Коллега'),
|
||||
('friend', 'Друг'),
|
||||
('family', 'Родственник'),
|
||||
('acquaintance', 'Знакомый'),
|
||||
('business', 'Деловой партнёр'),
|
||||
('other', 'Другое'),
|
||||
]
|
||||
|
||||
|
||||
def choices_payload():
|
||||
return {
|
||||
'relation_types': [{'value': v, 'label': l} for v, l in RELATION_TYPES],
|
||||
'life_spheres': [{'value': v, 'label': l} for v, l in LIFE_SPHERES],
|
||||
'network_circles': [{'value': v, 'label': l} for v, l in NETWORK_CIRCLES],
|
||||
'interaction_intensities': [{'value': v, 'label': l} for v, l in INTERACTION_INTENSITY],
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('meta/choices/', views.meta_choices, name='meta-choices'),
|
||||
path('relation-types/', views.relation_types, name='relation-types'),
|
||||
path('network-map-choices/', views.network_map_choices, name='network-map-choices'),
|
||||
]
|
||||
@@ -0,0 +1,30 @@
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
from .choices import (
|
||||
RELATION_TYPES,
|
||||
LIFE_SPHERES,
|
||||
NETWORK_CIRCLES,
|
||||
INTERACTION_INTENSITY,
|
||||
choices_payload,
|
||||
)
|
||||
|
||||
|
||||
@api_view(['GET'])
|
||||
def meta_choices(request):
|
||||
"""Unified meta endpoint for all domain enums."""
|
||||
return Response(choices_payload())
|
||||
|
||||
|
||||
@api_view(['GET'])
|
||||
def relation_types(request):
|
||||
return Response([{'value': v, 'label': l} for v, l in RELATION_TYPES])
|
||||
|
||||
|
||||
@api_view(['GET'])
|
||||
def network_map_choices(request):
|
||||
return Response({
|
||||
'life_spheres': [{'value': v, 'label': l} for v, l in LIFE_SPHERES],
|
||||
'network_circles': [{'value': v, 'label': l} for v, l in NETWORK_CIRCLES],
|
||||
'interaction_intensities': [{'value': v, 'label': l} for v, l in INTERACTION_INTENSITY],
|
||||
})
|
||||
Reference in New Issue
Block a user