Compare commits
2 Commits
84d8f7fd12
...
2bbb3a0a95
Author | SHA1 | Date | |
---|---|---|---|
2bbb3a0a95 | |||
d91e561561 |
@ -11,7 +11,7 @@ router = APIRouter()
|
|||||||
|
|
||||||
|
|
||||||
@router.get("/events", tags=["events"], response_model=list[events.EventOut])
|
@router.get("/events", tags=["events"], response_model=list[events.EventOut])
|
||||||
async def read_events(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], skip: int = 0, limit: int = 20, id_event: str | None = None, name: str | None = None, status: int | None = None):
|
async def read_events(authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], skip: int = 0, limit: int = 20, id_event: str | None = None, name: str | None = None, status: int | None = None, tags: str | None = None, organizers: str | None = None):
|
||||||
if limit < 1 or skip < 0 or limit < skip:
|
if limit < 1 or skip < 0 or limit < skip:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_400_BAD_REQUEST,
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
@ -23,6 +23,12 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per
|
|||||||
object_search = {}
|
object_search = {}
|
||||||
if status is not None:
|
if status is not None:
|
||||||
object_search = {"status":{"$eq": status}}
|
object_search = {"status":{"$eq": status}}
|
||||||
|
|
||||||
|
if tags is not None:
|
||||||
|
object_search = {"tags":{"$eq": tags}}
|
||||||
|
|
||||||
|
if organizers is not None:
|
||||||
|
object_search = {"organizers":{"$eq": organizers}}
|
||||||
if id_event is not None:
|
if id_event is not None:
|
||||||
eventid = ObjectId(id_event)
|
eventid = ObjectId(id_event)
|
||||||
object_search = {"id": {"$regex": userid}}
|
object_search = {"id": {"$regex": userid}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user