diff --git a/app/routers/events.py b/app/routers/events.py index be93b40..3bec5aa 100644 --- a/app/routers/events.py +++ b/app/routers/events.py @@ -53,8 +53,18 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P event_repository = events.EventRepository(database=database.database) object_search = {} if item is not None: - object_search = { "$and": [{"$or":[{"name":{"$regex": item}}, {"tags":{"$regex":item}},{"organizers":{"$regex": item}}]},{"status":{"$eq":status}}]} - + object_search = { + "$and": [ + { + "$or": [ + {"name": {"$regex": item}}, + {"tags": {"$regex": item}}, + {"organizers": {"$regex": item}} + ] + }, + {"status": {"$eq": status}} + ] + } for event_index in event_repository.find_by(object_search, limit=limit, skip=skip): event = events.EventOut(id=event_index.id, tags=event_index.tags, imgUrl=event_index.imgUrl, name=event_index.name, description=event_index.description, place=event_index.place, zip_code=event_index.zip_code, city=event_index.city, country=event_index.country, status=event_index.status, start_date=event_index.start_date, end_date=event_index.end_date) listEvents.append(event)