def floors(): cur = get_cursor() building = request.args.get('building') cur.execute('select distinct floor from rooms where building = ?', (building,)) return jsonify({ 'building': building, 'floors': to_array(cur.fetchall())})
def rooms(): cur = get_cursor() building = request.args.get('building') floor = request.args.get('floor') cur.execute('select room from rooms where building = ? and floor = ?', (building, floor)) return jsonify({ 'building': building, 'floor': floor, 'rooms': to_array(cur.fetchall()) })
def buildings(): cur = get_cursor() cur.execute('select distinct building from rooms') r = cur.fetchall() return jsonify({'buildings': to_array(r)})