Merge pull request 'fix object_search' (#22) from feature/search into master
Reviewed-on: #22
This commit is contained in:
commit
df4a2bead6
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user