From 7f34e835e36e5cb4c19552dae0a9c369ebdf4466 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 28 Nov 2024 23:17:19 +0100 Subject: [PATCH] add options i --- app/routers/events.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/routers/events.py b/app/routers/events.py index bd340f0..610b825 100644 --- a/app/routers/events.py +++ b/app/routers/events.py @@ -147,9 +147,9 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per {"start_date": {"$lte": end_of_day}} ]} if name is not None: - object_search = {"$and":[{"name":{"$regex": name}}, {"status":{"$eq":status}}]} + object_search = {"$and":[{"name":{"$regex": name, '$options': 'i'}}, {"status":{"$eq":status}}]} if current_datetime is not None: - object_search = {"$and":[{"name":{"$regex": name}}, + object_search = {"$and":[{"name":{"$regex": name, '$options': 'i'}}, {"status":{"$eq":status}}, { "$or": [ @@ -165,7 +165,7 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per } ]} if date_selected is True: - object_search = {"$and":[{"name":{"$regex": name}}, + object_search = {"$and":[{"name":{"$regex": name, '$options': 'i'}}, {"status":{"$eq":status}}, {"start_date": {"$gte": start_of_day}}, {"start_date": {"$lte": end_of_day}} @@ -270,9 +270,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P "$and": [ { "$or": [ - {"name": {"$regex": item}}, + {"name": {"$regex": item, "$options": 'i'}}, {"tags": {"$regex": item}}, - {"organizers": {"$regex": item}} + {"organizers": {"$regex": item, "$options": 'i'}} ] }, {"status": {"$eq": status}} @@ -283,9 +283,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P "$and": [ { "$or": [ - {"name": {"$regex": item}}, + {"name": {"$regex": item, "$options": 'i'}}, {"tags": {"$regex": item}}, - {"organizers": {"$regex": item}} + {"organizers": {"$regex": item, "$options": 'i'}} ] }, {"status": {"$eq": status}}, @@ -308,9 +308,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P "$and": [ { "$or": [ - {"name": {"$regex": item}}, + {"name": {"$regex": item, "$options": 'i'}}, {"tags": {"$regex": item}}, - {"organizers": {"$regex": item}} + {"organizers": {"$regex": item, "$options": 'i'}} ] }, {"status": {"$eq": status}}, @@ -323,9 +323,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P "$and": [ { "$or": [ - {"name": {"$regex": item}}, + {"name": {"$regex": item, "$options": 'i'}}, {"tags": {"$regex": item}}, - {"organizers": {"$regex": item}} + {"organizers": {"$regex": item, "$options": 'i'}} ] }, {"status": {"$eq": status}}, @@ -348,9 +348,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P "$and": [ { "$or": [ - {"name": {"$regex": item}}, + {"name": {"$regex": item, "$options": 'i'}}, {"tags": {"$regex": item}}, - {"organizers": {"$regex": item}} + {"organizers": {"$regex": item, "$options": 'i'}} ] }, {"status": {"$eq": status}}, @@ -385,9 +385,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P "$and": [ { "$or": [ - {"name": {"$regex": item}}, + {"name": {"$regex": item, "$options": 'i'}}, {"tags": {"$regex": item}}, - {"organizers": {"$regex": item}} + {"organizers": {"$regex": item, "$options": 'i'}} ] }, {"status": {"$eq": status}}, -- 2.47.1