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,19 @@
|
||||
from rest_framework import status
|
||||
from rest_framework.decorators import api_view
|
||||
from rest_framework.response import Response
|
||||
|
||||
from .services import parse_upload_file, import_contacts_from_rows
|
||||
|
||||
|
||||
@api_view(['POST'])
|
||||
def import_contacts(request):
|
||||
file = request.FILES.get('file')
|
||||
if not file:
|
||||
return Response({'error': 'Файл не передан.'}, status=status.HTTP_400_BAD_REQUEST)
|
||||
try:
|
||||
rows, error = parse_upload_file(file)
|
||||
if error:
|
||||
return Response({'error': error}, status=status.HTTP_400_BAD_REQUEST)
|
||||
return Response(import_contacts_from_rows(rows))
|
||||
except Exception as e:
|
||||
return Response({'error': f'Ошибка разбора файла: {e}'}, status=status.HTTP_400_BAD_REQUEST)
|
||||
Reference in New Issue
Block a user