Esempio n. 1
0
    def mutate(self, info, **kwargs):
        user = info.context.user
        process = Process.filter_permissions(
            Process.objects, Process.permission_filters(user))\
            .get(pk=kwargs["id"])
        if "input" in kwargs: process.input = kwargs["input"]
        if "result" in kwargs: process.result = kwargs["result"]
        if "user" in kwargs:
            user = User.objects.get(pk=kwargs["user"])
            process.user = user
        process.save()

        return SetProcessMutation(process=process)
Esempio n. 2
0
 def get_queryset(self):
     user = self.request.user
     return Process.filter_permissions(
         super().get_queryset(), Process.permission_filters(user))
Esempio n. 3
0
 def resolve_process(self, info, id):
     user = info.context.user
     return ProcessModel.filter_permissions(
         ProcessModel.objects,
         ProcessModel.permission_filters(user)).get(pk=id)