mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
[WIP] added endpoint and dao to create invites for users.
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.
This commit is contained in:
24
app/invite/rest.py
Normal file
24
app/invite/rest.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
Reference in New Issue
Block a user