mirror of
https://github.com/evraz-hack/backend.git
synced 2024-11-29 04:23:44 +03:00
26 lines
856 B
Python
26 lines
856 B
Python
from rest_framework import generics
|
|
from rest_framework.response import Response
|
|
|
|
from exhauster_analytics.analytics.services import get_signal_values
|
|
from exhauster_analytics.analytics.api.serializers import (
|
|
ExgausterSerializer,
|
|
ExgausterSignalSerializer,
|
|
)
|
|
from exhauster_analytics.analytics.models import Exgauster
|
|
|
|
|
|
class ListExgauster(generics.ListAPIView):
|
|
serializer_class = ExgausterSerializer
|
|
queryset = Exgauster.objects.all()
|
|
permission_classes = []
|
|
|
|
|
|
class GetApproximatedExgausterSignals(generics.GenericAPIView):
|
|
serializer_class = ExgausterSignalSerializer
|
|
permission_classes = []
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
serializer = ExgausterSignalSerializer(data=request.data)
|
|
serializer.is_valid(raise_exception=True)
|
|
return Response(data=get_signal_values(**serializer.data))
|