Beispiel #1
0
	def mutate(payload, self, info, **kwargs):
		res = {'status': False, 'path': 'build_basket'}
		if payload['isAuth'] == True:
			if len(kwargs['userid']) != 0:
				user_id		= JSONDecoder(kwargs['userid'])
				setup 		= SetupFoodBasket(user_id)
				res 		= setup.build_basket()
				return res
			else:
				return res
		else:
			return res
		return SetupFoodBasketRes(status=res['status'], path=res['path'])
Beispiel #2
0
 def mutate(payload, self, info, **kwargs):
     res = {'status': False, 'path': 'who_bought_inggr'}
     if payload['isAuth'] == True:
         if len(kwargs['userid']) and len(kwargs['basketid']) != 0:
             if len(kwargs['chefid']) != 0:
                 user_id = JSONDecoder(kwargs['userid'])
                 chef_id = JSONDecoder(kwargs['chefid'])
                 basket_id = JSONDecoder(kwargs['basketid'])
                 setup = SetupFoodBasket(user_id, None, basket_id)
                 res = setup.who_bought_inggr(chef_id)
                 return res
             else:
                 return res
         else:
             res
     else:
         return res
     return SetupFoodBasketRes(status=res['status'], path=res['path'])
Beispiel #3
0
 def mutate(payload, self, info, **kwargs):
     res = {'status': False, 'path': 'push_food'}
     if payload['isAuth'] == True:
         if len(kwargs['userid']) and len(kwargs['chefid']) != 0:
             if len(kwargs['foodstuffid']) != 0:
                 user_id = JSONDecoder(kwargs['userid'])
                 foodstuff_id = JSONDecoder(kwargs['foodstuffid'])
                 chef_id = JSONDecoder(kwargs['chefid'])
                 setup = SetupFoodBasket(user_id, foodstuff_id)
                 res = setup.push_foodbasket(chef_id)
                 return res
             else:
                 return res
         else:
             return res
     else:
         return res
     return SetupFoodBasketRes(status=res['status'], path=res['path'])
Beispiel #4
0
 def mutate(payload, self, info, **kwargs):
     res = {'status': False, 'path': 'push_kitchen_tool'}
     if payload['isAuth'] == True:
         if len(kwargs['userid']) and len(kwargs['basketid']) != 0:
             if len(kwargs['chefid']) and len(kwargs['kitchenid']) != 0:
                 user_id = JSONDecoder(kwargs['userid'])
                 chef_id = JSONDecoder(kwargs['chefid'])
                 basket_id = JSONDecoder(kwargs['basketid'])
                 kitchen_id = map(lambda x: JSONDecoder(x),
                                  kwargs['kitchenid'])
                 setup = SetupFoodBasket(user_id, None, basket_id)
                 res = setup.push_kitchen_tool(chef_id, list(kitchen_id))
             else:
                 return res
         else:
             return res
     else:
         return res
     return SetupFoodBasketRes(status=res['status'], path=res['path'])
Beispiel #5
0
 def mutate(payload, self, info, **kwargs):
     res = {'status': False, 'path': 'req_schedule'}
     if payload['isAuth'] == True:
         if len(kwargs['userid']) and len(kwargs['basketid']) != 0:
             if len(kwargs['chefid']) and len(
                     kwargs['rqtime']) and len(kwargs['rqdate']) != 0:
                 user_id = JSONDecoder(kwargs['userid'])
                 chef_id = JSONDecoder(kwargs['chefid'])
                 basket_id = JSONDecoder(kwargs['basketid'])
                 rq_date = kwargs['rqdate']
                 rq_time = f"{kwargs['rqtime']}:00"
                 setup = SetupFoodBasket(user_id, None, basket_id)
                 res = setup.request_schedule(chef_id, rq_date, rq_time)
                 return res
             else:
                 return res
         else:
             return res
     else:
         return res
     return SetupFoodBasketRes(status=res['status'], path=res['path'])
Beispiel #6
0
 def mutate(payload, self, info, **kwargs):
     res = res = {'status': False, 'path': 'quantiti'}
     if payload['isAuth'] == True:
         if len(kwargs['userid']) and len(kwargs['chefid']) != 0:
             if len(kwargs['basketid']) and len(kwargs['foodstrid']) != 0:
                 if len(kwargs['quantiti']) != 0:
                     user_id = JSONDecoder(kwargs['userid'])
                     chef_id = JSONDecoder(kwargs['chefid'])
                     basket_id = JSONDecoder(kwargs['basketid'])
                     foodstr_id = kwargs['foodstrid']
                     quantiti = kwargs['quantiti']
                     setup = SetupFoodBasket(user_id, None, basket_id)
                     res = setup.update_quantiti(chef_id, foodstr_id,
                                                 quantiti)
                     return res
                 else:
                     return res
             else:
                 return res
         else:
             return res
     else:
         return res
     return SetupFoodBasketRes(status=res['status'], path=res['path'])