+
+ def create_alarm(self, alarm: Alarm):
+ return self.common_db.create('alarms', alarm.to_dict())
+
+ def delete_alarm(self, alarm_uuid: str):
+ return self.common_db.del_one('alarms', {'uuid': alarm_uuid})
+
+ def get_alarms(self) -> List[Alarm]:
+ alarms = []
+ alarm_dicts = self.common_db.get_list('alarms')
+ for alarm_dict in alarm_dicts:
+ alarms.append(Alarm.from_dict(alarm_dict))
+ return alarms
+
+ def get_user(self, username: str):
+ return self.common_db.get_one('users', {'username': username})
+
+ def get_user_by_id(self, userid: str):
+ return self.common_db.get_one('users', {'_id': userid})
+
+ def get_role_by_name(self, name: str):
+ return self.common_db.get_one('roles', {'name': name})