示例#1
0
def make_friend_request(user_id):
    current_user_id = current_user.get_id()
    # current_user_id = 3
    invite = Invite(inviter_id=current_user_id,
                    invitee_id=user_id,
                    type='friend')
    db.session.add(invite)
    db.session.commit()
    return invite.to_dict()
示例#2
0
def make_group_invite(username, group_id):
    current_user_id = current_user.get_id()
    user = User.query.filter(User.username == username).first()
    # current_user_id = 1
    invite = Invite(inviter_id=current_user_id,
                    invitee_id=user.id,
                    group_id=group_id,
                    type='group')
    db.session.add(invite)
    db.session.commit()
    return invite.to_dict()