Fixed direction errors

This commit is contained in:
Profitroll 2023-08-14 13:55:49 +02:00
parent 7011baff0f
commit c966a6de07
Signed by: profitroll
GPG Key ID: FA35CAB49DACD3B2
2 changed files with 13 additions and 21 deletions

View File

@ -621,7 +621,7 @@ async def photo_find(
} }
async for image in col_photos.find(db_query, limit=page_size, skip=skip).sort( async for image in col_photos.find(db_query, limit=page_size, skip=skip).sort(
"dates.uploaded", DESCENDING "dates.uploaded", direction=DESCENDING
): ):
output["results"].append( output["results"].append(
{ {

View File

@ -393,31 +393,23 @@ async def video_find(
"caption": re.compile(caption), "caption": re.compile(caption),
} }
elif caption is None: elif caption is None:
db_query = list( db_query = {
col_videos.find( "user": current_user.user,
{"user": current_user.user, "album": album, "filename": re.compile(q)}, "album": album,
limit=page_size, "filename": re.compile(q),
skip=skip, }
).sort("dates.uploaded", DESCENDING)
)
db_query_count = { db_query_count = {
"user": current_user.user, "user": current_user.user,
"album": album, "album": album,
"caption": re.compile(q), "caption": re.compile(q),
} }
else: else:
db_query = list( db_query = {
col_videos.find( "user": current_user.user,
{ "album": album,
"user": current_user.user, "filename": re.compile(q),
"album": album, "caption": re.compile(caption),
"filename": re.compile(q), }
"caption": re.compile(caption),
},
limit=page_size,
skip=skip,
).sort("dates.uploaded", DESCENDING)
)
db_query_count = { db_query_count = {
"user": current_user.user, "user": current_user.user,
"album": album, "album": album,
@ -426,7 +418,7 @@ async def video_find(
} }
async for video in col_videos.find(db_query, limit=page_size, skip=skip).sort( async for video in col_videos.find(db_query, limit=page_size, skip=skip).sort(
"dates.uploaded", DESCENDING "dates.uploaded", direction=DESCENDING
): ):
output["results"].append( output["results"].append(
{ {