style: drop redundant comments and apply formatting
Frontend now uses double quotes and semicolons. No behaviour change.
This commit is contained in:
+1
-3
@@ -13,7 +13,7 @@ bp = Blueprint("books", __name__, url_prefix="/api")
|
||||
|
||||
MAX_TEXT = 500
|
||||
MAX_PAGES = 100_000
|
||||
MAX_GENRE_ID = 32_767 # SMALLINT
|
||||
MAX_GENRE_ID = 32_767
|
||||
GENRE_ID_PATTERN = re.compile(r"[0-9]{1,5}")
|
||||
REQUIRED_FIELDS = ("title", "author", "genre_id", "total_pages")
|
||||
FIELDS = set(REQUIRED_FIELDS) | {"current_page"}
|
||||
@@ -56,7 +56,6 @@ def to_json(row: dict) -> dict:
|
||||
|
||||
|
||||
def escape_like(term: str) -> str:
|
||||
# Backslash is Postgres's default LIKE escape character.
|
||||
return term.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_")
|
||||
|
||||
|
||||
@@ -147,7 +146,6 @@ def create_book():
|
||||
return jsonify(to_json(owned_book(row["id"]))), 201
|
||||
|
||||
|
||||
# int(max=...) keeps ids within Postgres INT range: larger values 404 instead of erroring in SQL.
|
||||
@bp.get("/books/<int(max=2147483647):book_id>")
|
||||
@login_required
|
||||
def get_book(book_id: int):
|
||||
|
||||
Reference in New Issue
Block a user