Esempio n. 1
0
def memberbooth_member(member_number=Arg(int)):
    member = db_session.query(Member).filter(
        Member.member_number == member_number,
        Member.deleted_at.is_(None)).first()

    if not member:
        return None

    membership_data = get_membership_summary(member.member_id)
    return memberbooth_response_object(member, membership_data)
Esempio n. 2
0
def filter_start_package(cart_item, member_id):
    end_date = get_membership_summary(member_id).labaccess_end
    
    if not end_date:
        return

    if date.today() < end_date + timedelta(days=30 * 9):
        raise BadRequest("Starterpack can only be bought if you haven't had"
                         " lab acccess during the last 9 months (30*9 days).")

    if cart_item['count'] > 1:
        raise BadRequest("You may only buy a single Starterpack.")
Esempio n. 3
0
def memberbooth_tag(tagid=Arg(int)):
    key = db_session.query(Key)\
        .join(Key.member) \
        .filter(Key.tagid == tagid) \
        .filter(
            Member.deleted_at.is_(None),
            Key.deleted_at.is_(None),
        ) \
        .first()

    if key is None:
        return None

    membership_data = get_membership_summary(key.member_id)
    return memberbooth_response_object(key.member, membership_data)
Esempio n. 4
0
def member_get_membership(entity_id=None):
    return get_membership_summary(entity_id).as_json()
Esempio n. 5
0
def current_membership_info():
    """ Get current user membership information. """
    return get_membership_summary(g.user_id).as_json()