[events] Fix conflic return code
This commit is contained in:
parent
974af80a9b
commit
1b371763ee
|
@ -1,7 +1,7 @@
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from werkzeug.exceptions import BadRequest, NotFound
|
from werkzeug.exceptions import BadRequest, Conflict, NotFound
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
|
||||||
from flaschengeist import logger
|
from flaschengeist import logger
|
||||||
|
@ -41,7 +41,7 @@ def create_event_type(name):
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return event
|
return event
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
raise BadRequest("Name already exists")
|
raise Conflict("Name already exists")
|
||||||
|
|
||||||
|
|
||||||
def rename_event_type(identifier, new_name):
|
def rename_event_type(identifier, new_name):
|
||||||
|
@ -50,7 +50,7 @@ def rename_event_type(identifier, new_name):
|
||||||
try:
|
try:
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
raise BadRequest("Name already exists")
|
raise Conflict("Name already exists")
|
||||||
|
|
||||||
|
|
||||||
def delete_event_type(name):
|
def delete_event_type(name):
|
||||||
|
|
|
@ -75,7 +75,7 @@ def list_users(current_session):
|
||||||
|
|
||||||
@UsersPlugin.blueprint.route("/users/<userid>", methods=["GET"])
|
@UsersPlugin.blueprint.route("/users/<userid>", methods=["GET"])
|
||||||
@login_required()
|
@login_required()
|
||||||
@headers({"Cache-Control": "private, must-revalidate, max-age=3600"})
|
@headers({"Cache-Control": "private, must-revalidate, max-age=300"})
|
||||||
def get_user(userid, current_session):
|
def get_user(userid, current_session):
|
||||||
"""Retrieve user by userid
|
"""Retrieve user by userid
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue