Skip to content

Commit

Permalink
Remove API endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat committed Dec 24, 2024
1 parent 8d80858 commit bc47bc5
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions src/backend/InvenTree/part/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django_filters.rest_framework import DjangoFilterBackend
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema_field
from rest_framework import permissions, serializers, status
from rest_framework import permissions, serializers
from rest_framework.exceptions import ValidationError
from rest_framework.response import Response

Expand Down Expand Up @@ -1925,44 +1925,6 @@ class BomDetail(BomMixin, RetrieveUpdateDestroyAPI):
"""API endpoint for detail view of a single BomItem object."""


class BomImportUpload(CreateAPI):
"""API endpoint for uploading a complete Bill of Materials.
It is assumed that the BOM has been extracted from a file using the BomExtract endpoint.
"""

queryset = Part.objects.all()
serializer_class = part_serializers.BomImportUploadSerializer

def create(self, request, *args, **kwargs):
"""Custom create function to return the extracted data."""
# Clean up input data
data = self.clean_data(request.data)

serializer = self.get_serializer(data=data)
serializer.is_valid(raise_exception=True)
self.perform_create(serializer)
headers = self.get_success_headers(serializer.data)

data = serializer.extract_data()

return Response(data, status=status.HTTP_201_CREATED, headers=headers)


class BomImportExtract(CreateAPI):
"""API endpoint for extracting BOM data from a BOM file."""

queryset = Part.objects.none()
serializer_class = part_serializers.BomImportExtractSerializer


class BomImportSubmit(CreateAPI):
"""API endpoint for submitting BOM data from a BOM file."""

queryset = BomItem.objects.none()
serializer_class = part_serializers.BomImportSubmitSerializer


class BomItemValidate(UpdateAPI):
"""API endpoint for validating a BomItem."""

Expand Down Expand Up @@ -2306,10 +2268,6 @@ class BomItemSubstituteDetail(RetrieveUpdateDestroyAPI):
path('', BomDetail.as_view(), name='api-bom-item-detail'),
]),
),
# API endpoint URLs for importing BOM data
path('import/upload/', BomImportUpload.as_view(), name='api-bom-import-upload'),
path('import/extract/', BomImportExtract.as_view(), name='api-bom-import-extract'),
path('import/submit/', BomImportSubmit.as_view(), name='api-bom-import-submit'),
# Catch-all
path('', BomList.as_view(), name='api-bom-list'),
]

0 comments on commit bc47bc5

Please sign in to comment.