Commit 8a0bb0d0 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Let clients fetch only a part of their services

parent 162f2077
from rest_framework import generics
from rest_framework.authentication import TokenAuthentication
from .. import rabbitmq
from . import serializers, models
......@@ -15,14 +14,24 @@ class DeploymentsView(generics.RetrieveAPIView):
serializer_class = serializers.DeploymentsSerializer
def get_object(self):
all = False
all_services = False
if ('all' in self.request.query_params and
self.request.query_params['all'] == 'true'):
all = True
all_services = True
# the client may want only a special selection of services
if 's' in self.request.query_params:
filter_services = self.request.query_params.getlist('s')
filter_services = None
d = models.Deployments() = =
return d
......@@ -70,7 +70,7 @@ class Site(models.Model):
self.last_fetch = make_aware(
def clientapi_get_deployments(self, all=False):
def clientapi_get_deployments(self, all=False, filter=None):
def service_deployments(service):
if all:
ds = (
......@@ -92,9 +92,17 @@ class Site(models.Model):
return ds
if filter is not None:
services = [s
for s
if in filter]
services =
deployments = { service_deployments(service)
for service
in services}
# TODO we expect the client to get the update here
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment