Compare commits

..

3 Commits

4 changed files with 6 additions and 5 deletions

View File

@ -44,6 +44,7 @@ class ModelSerializeMixin:
class Serial(TypeDecorator): class Serial(TypeDecorator):
"""Same as MariaDB Serial used for IDs""" """Same as MariaDB Serial used for IDs"""
cache_ok=True
impl = BigInteger().with_variant(mysql.BIGINT(unsigned=True), "mysql").with_variant(sqlite.INTEGER, "sqlite") impl = BigInteger().with_variant(mysql.BIGINT(unsigned=True), "mysql").with_variant(sqlite.INTEGER, "sqlite")

View File

@ -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):

View File

@ -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

View File

@ -46,7 +46,7 @@ If not you need to create user and database manually do (or similar on Windows):
( (
echo "CREATE DATABASE flaschengeist;" echo "CREATE DATABASE flaschengeist;"
echo "CREATE USER 'flaschengeist'@'localhost' IDENTIFIED BY 'flaschengeist';" echo "CREATE USER 'flaschengeist'@'localhost' IDENTIFIED BY 'flaschengeist';"
echo "GRANT ALL PRIVILEGES ON 'flaschengeist'.* TO 'flaschengeist'@'localhost';" echo "GRANT ALL PRIVILEGES ON flaschengeist.* TO 'flaschengeist'@'localhost';"
echo "FLUSH PRIVILEGES;" echo "FLUSH PRIVILEGES;"
) | sudo mysql ) | sudo mysql