Skip to content

Commit f4b29a9

Browse files
committed
linted
1 parent a7dd5dd commit f4b29a9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

backend/models/data_documents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class DataDocumentsFilter(BaseModel):
66
key: str
77
value: Any = "" # Can be str, int, etc. depending on the field type
8-
operator: Optional[str] = "equals" # 'equals', 'exists', 'not_exists'
8+
operator: Optional[str] = "equals" # 'equals', 'exists', 'not_exists'
99

1010

1111
class DataDocumentsRequest(BaseModel):

backend/services/data_documents_service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,18 @@ def get_query_for_filter(f: dict):
102102
key = f.get("key")
103103
value = f.get("value")
104104
operator = f.get("operator", "equals")
105-
105+
106106
if not key:
107107
return {}
108-
108+
109109
if operator == "exists":
110110
return {key: {"$exists": True}}
111111
if operator == "not_exists":
112112
return {key: {"$exists": False}}
113-
113+
114114
if value is None:
115115
return {}
116-
116+
117117
if key == "all":
118118
sample_doc = collection.find_one()
119119
if sample_doc:
@@ -134,7 +134,7 @@ def get_query_for_filter(f: dict):
134134
query_val = value
135135
else:
136136
query_val = value
137-
137+
138138
if operator == "not_equals":
139139
return {key: {"$ne": query_val}}
140140
if operator == "greater_than":
@@ -143,7 +143,7 @@ def get_query_for_filter(f: dict):
143143
return {key: {"$lt": query_val}}
144144
if operator == "contains":
145145
return {key: {"$regex": re.escape(str(value)), "$options": "i"}}
146-
146+
147147
# default equals
148148
if isinstance(query_val, str) and key != "_id":
149149
return {key: {"$regex": re.escape(query_val), "$options": "i"}}

0 commit comments

Comments
 (0)