Ejemplo n.º 1
0
    def admin(event_id: int):
        e: Event = Event.get_or_none(event_id)
        if e is None:
            abort(404)

        try:
            i: Instance = Instance.get(Instance.name == e.instance)

            api = RdyApi(i.hostname, i.api_key)
            groups = list(Groups.select().where(
                Groups.event_id == event_id).namedtuples())

        except json.decoder.JSONDecodeError:
            abort(500, 'API Key invalid!')

        except DoesNotExist:
            abort(500, 'Instance does not Exist!')

        return dict(name=e.name,
                    event_id=e.event_id,
                    instance=i.name,
                    instance_host=i.hostname,
                    groups=groups)