Align frontend API contracts #14
@@ -285,7 +285,9 @@ class BackgroundJobStreamView(BackgroundJobStatusView):
|
|||||||
"task_id": job.task_id,
|
"task_id": job.task_id,
|
||||||
"status": "error",
|
"status": "error",
|
||||||
"progress": job.progress,
|
"progress": job.progress,
|
||||||
"message": job.error or job.progress_message or "Задача завершилась с ошибкой",
|
"message": job.error
|
||||||
|
or job.progress_message
|
||||||
|
or "Задача завершилась с ошибкой",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ from apps.parsers.models import (
|
|||||||
IndustrialProductRecord,
|
IndustrialProductRecord,
|
||||||
InspectionRecord,
|
InspectionRecord,
|
||||||
ManufacturerRecord,
|
ManufacturerRecord,
|
||||||
ParsingSettings,
|
|
||||||
ParserLoadLog,
|
ParserLoadLog,
|
||||||
|
ParsingSettings,
|
||||||
ProcurementRecord,
|
ProcurementRecord,
|
||||||
Proxy,
|
Proxy,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ from apps.parsers.views import (
|
|||||||
IndustrialProductViewSet,
|
IndustrialProductViewSet,
|
||||||
InspectionViewSet,
|
InspectionViewSet,
|
||||||
ManufacturerViewSet,
|
ManufacturerViewSet,
|
||||||
ParsingSettingsView,
|
|
||||||
ParserLoadLogExportView,
|
ParserLoadLogExportView,
|
||||||
ParserLoadLogViewSet,
|
ParserLoadLogViewSet,
|
||||||
|
ParsingSettingsView,
|
||||||
ProcurementViewSet,
|
ProcurementViewSet,
|
||||||
ProxyViewSet,
|
ProxyViewSet,
|
||||||
SourceCardDetailView,
|
SourceCardDetailView,
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ from apps.parsers.models import (
|
|||||||
IndustrialProductRecord,
|
IndustrialProductRecord,
|
||||||
InspectionRecord,
|
InspectionRecord,
|
||||||
ManufacturerRecord,
|
ManufacturerRecord,
|
||||||
ParsingSettings,
|
|
||||||
ParserLoadLog,
|
ParserLoadLog,
|
||||||
|
ParsingSettings,
|
||||||
ProcurementRecord,
|
ProcurementRecord,
|
||||||
Proxy,
|
Proxy,
|
||||||
)
|
)
|
||||||
@@ -28,10 +28,10 @@ from apps.parsers.serializers import (
|
|||||||
IndustrialCertificateSerializer,
|
IndustrialCertificateSerializer,
|
||||||
IndustrialProductSerializer,
|
IndustrialProductSerializer,
|
||||||
InspectionSerializer,
|
InspectionSerializer,
|
||||||
ParserLoadLogListSerializer,
|
|
||||||
ParsingSettingsSerializer,
|
|
||||||
ManufacturerSerializer,
|
ManufacturerSerializer,
|
||||||
|
ParserLoadLogListSerializer,
|
||||||
ParserLoadLogSerializer,
|
ParserLoadLogSerializer,
|
||||||
|
ParsingSettingsSerializer,
|
||||||
ProcurementSerializer,
|
ProcurementSerializer,
|
||||||
ProxySerializer,
|
ProxySerializer,
|
||||||
SourceCardDetailSerializer,
|
SourceCardDetailSerializer,
|
||||||
@@ -48,6 +48,7 @@ from django.http import HttpResponse
|
|||||||
from drf_yasg import openapi
|
from drf_yasg import openapi
|
||||||
from drf_yasg.utils import swagger_auto_schema
|
from drf_yasg.utils import swagger_auto_schema
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
|
from rest_framework.exceptions import ValidationError
|
||||||
from rest_framework.parsers import MultiPartParser
|
from rest_framework.parsers import MultiPartParser
|
||||||
from rest_framework.permissions import IsAdminUser, IsAuthenticated
|
from rest_framework.permissions import IsAdminUser, IsAuthenticated
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
@@ -170,7 +171,9 @@ def _paginate_results(request, rows: list[dict]):
|
|||||||
page_number = max(1, int(page_raw))
|
page_number = max(1, int(page_raw))
|
||||||
except (TypeError, ValueError) as exc:
|
except (TypeError, ValueError) as exc:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
{"detail": "Параметры page и page_size должны быть положительными целыми числами."}
|
{
|
||||||
|
"detail": "Параметры page и page_size должны быть положительными целыми числами."
|
||||||
|
}
|
||||||
) from exc
|
) from exc
|
||||||
|
|
||||||
paginator = Paginator(rows, page_size)
|
paginator = Paginator(rows, page_size)
|
||||||
@@ -1041,7 +1044,10 @@ class ParserLoadLogExportView(APIView):
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
rows = [_serialize_parser_log_row(item) for item in _apply_parser_log_filters(request)]
|
rows = [
|
||||||
|
_serialize_parser_log_row(item)
|
||||||
|
for item in _apply_parser_log_filters(request)
|
||||||
|
]
|
||||||
search_term = request.query_params.get("search", "").strip()
|
search_term = request.query_params.get("search", "").strip()
|
||||||
if search_term:
|
if search_term:
|
||||||
rows = [row for row in rows if _matches_parser_log_search(row, search_term)]
|
rows = [row for row in rows if _matches_parser_log_search(row, search_term)]
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ def backfill_profile_names(apps, schema_editor):
|
|||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
atomic = False
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
("user", "0009_alter_user_groups"),
|
("user", "0009_alter_user_groups"),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -258,9 +258,7 @@ class AdminUserUpdateSerializer(serializers.ModelSerializer):
|
|||||||
required=False,
|
required=False,
|
||||||
help_text="Прикладная роль пользователя",
|
help_text="Прикладная роль пользователя",
|
||||||
)
|
)
|
||||||
first_name = serializers.CharField(
|
first_name = serializers.CharField(required=False, allow_blank=True)
|
||||||
required=False, allow_blank=True
|
|
||||||
)
|
|
||||||
middle_name = serializers.CharField(
|
middle_name = serializers.CharField(
|
||||||
required=False,
|
required=False,
|
||||||
allow_blank=True,
|
allow_blank=True,
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ from django.contrib.auth import get_user_model
|
|||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import F, Q
|
from django.db.models import F, Q
|
||||||
from rest_framework_simplejwt.token_blacklist.models import BlacklistedToken, OutstandingToken
|
from rest_framework_simplejwt.token_blacklist.models import (
|
||||||
|
BlacklistedToken,
|
||||||
|
OutstandingToken,
|
||||||
|
)
|
||||||
from rest_framework_simplejwt.tokens import RefreshToken
|
from rest_framework_simplejwt.tokens import RefreshToken
|
||||||
|
|
||||||
from .models import Profile
|
from .models import Profile
|
||||||
|
|||||||
Reference in New Issue
Block a user