Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
1dd2fed95f | |||
b7ae697ea6 | |||
03036b2d3b | |||
e07a74384f | |||
32b6fdacb6 | |||
2baaf3c126 |
@ -84,8 +84,7 @@ async def read_events(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail="`skip` should be >= 0 and `limit` should be > 0 and greater than `skip`.",
|
||||
)
|
||||
limit = limit + skip
|
||||
|
||||
skip = limit * skip
|
||||
# Initialize filters
|
||||
filters = []
|
||||
|
||||
@ -127,7 +126,7 @@ async def read_events(
|
||||
# Fetch and return results
|
||||
event_repository = events.EventRepository(database=database.database)
|
||||
list_events = []
|
||||
for event_index in event_repository.find_by(object_search, limit=limit, skip=skip):
|
||||
for event_index in event_repository.find_by(object_search, limit=limit, skip=skip, sort=[("start_date", 1)]):
|
||||
event = events.EventOut(
|
||||
id=event_index.id,
|
||||
tags=event_index.tags,
|
||||
@ -166,7 +165,7 @@ async def search_events(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail="`skip` should be >= 0 and `limit` should be > 0 and greater than `skip`.",
|
||||
)
|
||||
limit = limit + skip
|
||||
skip = limit * skip
|
||||
|
||||
# Initialize filters
|
||||
filters = [{"status": {"$eq": status}}]
|
||||
@ -201,7 +200,7 @@ async def search_events(
|
||||
# Fetch and return results
|
||||
event_repository = events.EventRepository(database=database.database)
|
||||
list_events = []
|
||||
for event_index in event_repository.find_by(object_search, limit=limit, skip=skip):
|
||||
for event_index in event_repository.find_by(object_search, limit=limit, skip=skip, sort=[("start_date", 1)]):
|
||||
event = events.EventOut(
|
||||
id=event_index.id,
|
||||
tags=event_index.tags,
|
||||
|
@ -1,7 +1,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from typing import Annotated
|
||||
from fastapi import Depends, FastAPI, HTTPException, status, APIRouter
|
||||
from fastapi import Depends, FastAPI, HTTPException, status, APIRouter, Form
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||
from ..dependencies import users_token, permissions_checker
|
||||
|
Loading…
x
Reference in New Issue
Block a user