fix object_search #22
@ -53,8 +53,18 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
|
|||||||
event_repository = events.EventRepository(database=database.database)
|
event_repository = events.EventRepository(database=database.database)
|
||||||
object_search = {}
|
object_search = {}
|
||||||
if item is not None:
|
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):
|
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)
|
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)
|
listEvents.append(event)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user