mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 06:38:26 -04:00
110067722: Post add-service endpoint saves the service and maps it to the user.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from flask import render_template, jsonify, redirect
|
||||
from flask import render_template, jsonify, redirect, session
|
||||
from flask_login import login_required
|
||||
|
||||
from app.main import main
|
||||
from app.main.dao import services_dao, users_dao
|
||||
from app.main.forms import AddServiceForm
|
||||
|
||||
|
||||
@@ -17,7 +18,8 @@ def process_add_service():
|
||||
form = AddServiceForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
user = users_dao.get_user_by_id(session['user_id'])
|
||||
services_dao.insert_new_service(form.service_name.data, user)
|
||||
return redirect('/dashboard')
|
||||
else:
|
||||
return jsonify(form.errors), 400
|
||||
|
||||
Reference in New Issue
Block a user