#31 API WIP
* adds support for GET /check on intervention to run checks automatically via API
This commit is contained in:
@@ -13,13 +13,23 @@ from api.utils.serializer.v1.compensation import CompensationAPISerializerV1
|
||||
from api.utils.serializer.v1.ecoaccount import EcoAccountAPISerializerV1
|
||||
from api.utils.serializer.v1.ema import EmaAPISerializerV1
|
||||
from api.utils.serializer.v1.intervention import InterventionAPISerializerV1
|
||||
from api.views.views import AbstractModelAPIView
|
||||
from api.views.views import AbstractAPIView
|
||||
|
||||
|
||||
class AbstractModelAPIViewV1(AbstractModelAPIView):
|
||||
class AbstractAPIViewV1(AbstractAPIView):
|
||||
""" Holds general serialization functions for API v1
|
||||
|
||||
"""
|
||||
serializer = None
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.lookup = {
|
||||
"id": None, # must be set in subclasses
|
||||
"deleted__isnull": True,
|
||||
"users__in": [], # must be set in subclasses
|
||||
}
|
||||
super().__init__(*args, **kwargs)
|
||||
self.serializer = self.serializer()
|
||||
|
||||
def get(self, request: HttpRequest, id=None):
|
||||
""" Handles the GET request
|
||||
@@ -80,17 +90,17 @@ class AbstractModelAPIViewV1(AbstractModelAPIView):
|
||||
return JsonResponse({"id": updated_id})
|
||||
|
||||
|
||||
class InterventionAPIViewV1(AbstractModelAPIViewV1):
|
||||
class InterventionAPIViewV1(AbstractAPIViewV1):
|
||||
serializer = InterventionAPISerializerV1
|
||||
|
||||
|
||||
class CompensationAPIViewV1(AbstractModelAPIViewV1):
|
||||
class CompensationAPIViewV1(AbstractAPIViewV1):
|
||||
serializer = CompensationAPISerializerV1
|
||||
|
||||
|
||||
class EcoAccountAPIViewV1(AbstractModelAPIViewV1):
|
||||
class EcoAccountAPIViewV1(AbstractAPIViewV1):
|
||||
serializer = EcoAccountAPISerializerV1
|
||||
|
||||
|
||||
class EmaAPIViewV1(AbstractModelAPIViewV1):
|
||||
class EmaAPIViewV1(AbstractAPIViewV1):
|
||||
serializer = EmaAPISerializerV1
|
||||
|
||||
Reference in New Issue
Block a user