add endpoints to fetch a user based on their ID only

this functions the same as `validate_invitation_token`, but without
having the signed token, instead just the ID. This is so later endpoints
within the invite flow can also fetch the invited user
This commit is contained in:
Leo Hemsted
2021-03-05 20:54:25 +00:00
parent d94d0bc8d7
commit 4471189b87
2 changed files with 51 additions and 0 deletions

View File

@@ -38,3 +38,15 @@ def validate_invitation_token(invitation_type, token):
return jsonify(data=invited_user.serialize()), 200
else:
raise InvalidRequest("Unrecognised invitation type: {}".format(invitation_type))
@global_invite_blueprint.route('/service/<uuid:invited_user_id>', methods=['GET'])
def get_invited_user(invited_user_id):
invited_user = get_invited_user_by_id(invited_user_id)
return jsonify(data=invited_user_schema.dump(invited_user).data), 200
@global_invite_blueprint.route('/organisation/<uuid:invited_org_user_id>', methods=['GET'])
def get_invited_org_user(invited_org_user_id):
invited_user = dao_get_invited_organisation_user(invited_org_user_id)
return jsonify(data=invited_user.serialize()), 200