Skip to content

Commit

Permalink
refactor(chalice): refactored search sessions hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
tahayk committed Jul 16, 2024
1 parent 882a6ce commit 1fe8734
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions api/schemas/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,16 +762,15 @@ def transform_order(cls, values):
@model_validator(mode="before")
def add_missing_attributes(cls, values):
# in case isEvent is wrong:
for f in values.get("filters"):
for f in values.get("filters") or []:
if EventType.has_value(f["type"]) and not f.get("isEvent"):
f["isEvent"] = True
elif FilterType.has_value(f["type"]) and f.get("isEvent"):
f["isEvent"] = False

# in case the old search payload was passed
if len(values.get("events", [])) > 0:
for v in values["events"]:
v["isEvent"] = True
for v in values.get("events") or []:
v["isEvent"] = True

return values

Expand Down

0 comments on commit 1fe8734

Please sign in to comment.