add options i

This commit is contained in:
Valentin CZERYBA 2024-11-28 23:17:19 +01:00
parent 721d7a3a5d
commit 7f34e835e3

View File

@ -147,9 +147,9 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per
{"start_date": {"$lte": end_of_day}} {"start_date": {"$lte": end_of_day}}
]} ]}
if name is not None: 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: if current_datetime is not None:
object_search = {"$and":[{"name":{"$regex": name}}, object_search = {"$and":[{"name":{"$regex": name, '$options': 'i'}},
{"status":{"$eq":status}}, {"status":{"$eq":status}},
{ {
"$or": [ "$or": [
@ -165,7 +165,7 @@ async def read_events(authorize: Annotated[bool, Depends(permissions_checker.Per
} }
]} ]}
if date_selected is True: if date_selected is True:
object_search = {"$and":[{"name":{"$regex": name}}, object_search = {"$and":[{"name":{"$regex": name, '$options': 'i'}},
{"status":{"$eq":status}}, {"status":{"$eq":status}},
{"start_date": {"$gte": start_of_day}}, {"start_date": {"$gte": start_of_day}},
{"start_date": {"$lte": end_of_day}} {"start_date": {"$lte": end_of_day}}
@ -270,9 +270,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
"$and": [ "$and": [
{ {
"$or": [ "$or": [
{"name": {"$regex": item}}, {"name": {"$regex": item, "$options": 'i'}},
{"tags": {"$regex": item}}, {"tags": {"$regex": item}},
{"organizers": {"$regex": item}} {"organizers": {"$regex": item, "$options": 'i'}}
] ]
}, },
{"status": {"$eq": status}} {"status": {"$eq": status}}
@ -283,9 +283,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
"$and": [ "$and": [
{ {
"$or": [ "$or": [
{"name": {"$regex": item}}, {"name": {"$regex": item, "$options": 'i'}},
{"tags": {"$regex": item}}, {"tags": {"$regex": item}},
{"organizers": {"$regex": item}} {"organizers": {"$regex": item, "$options": 'i'}}
] ]
}, },
{"status": {"$eq": status}}, {"status": {"$eq": status}},
@ -308,9 +308,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
"$and": [ "$and": [
{ {
"$or": [ "$or": [
{"name": {"$regex": item}}, {"name": {"$regex": item, "$options": 'i'}},
{"tags": {"$regex": item}}, {"tags": {"$regex": item}},
{"organizers": {"$regex": item}} {"organizers": {"$regex": item, "$options": 'i'}}
] ]
}, },
{"status": {"$eq": status}}, {"status": {"$eq": status}},
@ -323,9 +323,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
"$and": [ "$and": [
{ {
"$or": [ "$or": [
{"name": {"$regex": item}}, {"name": {"$regex": item, "$options": 'i'}},
{"tags": {"$regex": item}}, {"tags": {"$regex": item}},
{"organizers": {"$regex": item}} {"organizers": {"$regex": item, "$options": 'i'}}
] ]
}, },
{"status": {"$eq": status}}, {"status": {"$eq": status}},
@ -348,9 +348,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
"$and": [ "$and": [
{ {
"$or": [ "$or": [
{"name": {"$regex": item}}, {"name": {"$regex": item, "$options": 'i'}},
{"tags": {"$regex": item}}, {"tags": {"$regex": item}},
{"organizers": {"$regex": item}} {"organizers": {"$regex": item, "$options": 'i'}}
] ]
}, },
{"status": {"$eq": status}}, {"status": {"$eq": status}},
@ -385,9 +385,9 @@ async def search_events(authorize: Annotated[bool, Depends(permissions_checker.P
"$and": [ "$and": [
{ {
"$or": [ "$or": [
{"name": {"$regex": item}}, {"name": {"$regex": item, "$options": 'i'}},
{"tags": {"$regex": item}}, {"tags": {"$regex": item}},
{"organizers": {"$regex": item}} {"organizers": {"$regex": item, "$options": 'i'}}
] ]
}, },
{"status": {"$eq": status}}, {"status": {"$eq": status}},