human handoffs
This commit is contained in:
parent
79188e0f59
commit
36a55930f9
35 changed files with 4039 additions and 139 deletions
18
backend/app/services/mailbox_scope.py
Normal file
18
backend/app/services/mailbox_scope.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
EXTERNAL_SCOPE_FILTER = {
|
||||
"$or": [
|
||||
{"message_scope": "EXTERNAL"},
|
||||
{"message_scope": {"$exists": False}},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
def apply_external_scope(entry_match: dict) -> dict:
|
||||
if "$and" in entry_match:
|
||||
entry_match["$and"].append(EXTERNAL_SCOPE_FILTER)
|
||||
return entry_match
|
||||
if "$or" in entry_match:
|
||||
existing = entry_match.pop("$or")
|
||||
entry_match["$and"] = [{"$or": existing}, EXTERNAL_SCOPE_FILTER]
|
||||
return entry_match
|
||||
entry_match.update(EXTERNAL_SCOPE_FILTER)
|
||||
return entry_match
|
||||
Loading…
Add table
Add a link
Reference in a new issue