Ejemplo n.º 1
0
 def get_all_triggers(self):
     triggers = self.collection.find()
     target_triggers = []
     for trigger in triggers:
         target_triggers.append(Trigger(trigger))
     return target_triggers
Ejemplo n.º 2
0
 def get_actions_for_device(self, device_id):
     triggers = self.collection.find({'sensor_id': device_id})
     target_triggers = []
     for trigger in triggers:
         target_triggers.append(Trigger(trigger))
     return target_triggers
Ejemplo n.º 3
0
 def get_triggers_for_user(self, user_id):
     triggers = self.collection.find({'user_id': user_id})
     target_triggers = []
     for trigger in triggers:
         target_triggers.append(Trigger(trigger))
     return target_triggers
Ejemplo n.º 4
0
 def get_trigger_by_id(self, trigger_id):
     trigger = self.collection.find_one({'_id': trigger_id})
     if trigger is None:
         return None
     target_trigger = Trigger(trigger)
     return target_trigger