diff --git a/backend/app/core/base_crud.py b/backend/app/core/base_crud.py index 742ecd9992239bf35023537f89daea27fba56121..c870019f24bfce8b5e9162667e1909d18ce9e7a5 100644 --- a/backend/app/core/base_crud.py +++ b/backend/app/core/base_crud.py @@ -338,7 +338,13 @@ class CRUDBase(Generic[ModelType, CreateSchemaType, UpdateSchemaType]): elif seq == "!=" and val: conditions.append(attr != val) elif seq in [">", ">=", "<=", "=="] and val: - conditions.append(getattr(attr, seq.replace("==", "__eq__"))(val)) + op_map = { + ">": "__gt__", + ">=": "__ge__", + "<=": "__le__", + "==": "__eq__" + } + conditions.append(getattr(attr, op_map[seq])(val)) else: conditions.append(attr == value) return conditions