mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
Droped token as later code to send email invite can generate timebased url to send to user. That can then be checked against configurable time threshold for expiry. Therefore no need to store a token.
25 lines
642 B
Python
25 lines
642 B
Python
from flask import (
|
|
Blueprint,
|
|
request,
|
|
jsonify
|
|
)
|
|
|
|
from app.dao.invited_user_dao import save_invited_user
|
|
from app.schemas import invited_user_schema
|
|
|
|
invite = Blueprint('invite', __name__, url_prefix='/service/<service_id>/invite')
|
|
|
|
from app.errors import register_errors
|
|
register_errors(invite)
|
|
|
|
|
|
@invite.route('', methods=['POST'])
|
|
def create_invite_user(service_id):
|
|
invited_user, errors = invited_user_schema.load(request.get_json())
|
|
if errors:
|
|
return jsonify(result="error", message=errors), 400
|
|
|
|
save_invited_user(invited_user)
|
|
|
|
return jsonify(data=invited_user_schema.dump(invited_user).data), 201
|