protect settings write routes

+ prevent updating guest user
+ add docs to whitelisted auth routes
+ fix: sort in get all route
+ fix: folders not having trailing slash in recentlyplayed
This commit is contained in:
mungai-njoroge
2024-05-01 23:44:38 +03:00
parent cfeff7ff51
commit 5d947f3ad9
6 changed files with 37 additions and 23 deletions
+5 -8
View File
@@ -22,7 +22,7 @@ bp_tag = Tag(name="Get all", description="List all items")
api = APIBlueprint("getall", __name__, url_prefix="/getall", abp_tags=[bp_tag])
class GetAllItemsBody(GenericLimitSchema):
class GetAllItemsQuery(GenericLimitSchema):
start: int = Field(
description="The start index of the items to return",
example=0,
@@ -34,10 +34,10 @@ class GetAllItemsBody(GenericLimitSchema):
default="created_date",
)
reverse: int = Field(
reverse: str = Field(
description="Reverse the sort",
example=1,
default=1,
default="1",
)
@@ -50,7 +50,7 @@ class GetAllItemsPath(BaseModel):
@api.get("/<itemtype>")
def get_all_items(path: GetAllItemsPath, query: GetAllItemsBody):
def get_all_items(path: GetAllItemsPath, query: GetAllItemsQuery):
"""
Get all items
@@ -67,10 +67,7 @@ def get_all_items(path: GetAllItemsPath, query: GetAllItemsBody):
start = query.start
limit = query.limit
sort = query.sortby
reverse = query.reverse == 1
# if sort == "":
# sort = "created_date"
reverse = query.reverse == "1"
sort_is_count = sort == "count"
sort_is_duration = sort == "duration"