Skip to content

Commit

Permalink
[IMP] shopinvader: allow lang override from client on customer endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
simahawk authored and HviorForgeFlow committed Jun 19, 2023
1 parent 98cccdc commit 7296cbe
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions shopinvader/services/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def _validator_create(self):
schema = address._validator_create()
schema.update(
{
# Email is mandatory anyway
"email": {"type": "string", "required": True, "nullable": False},
"email": {"type": "string", "required": True},
"lang": {"type": "string", "required": False},
}
)
schema.update(self._validator_external_ref())
Expand All @@ -89,10 +89,16 @@ def _validator_update(self):
schema.update(self._validator_external_ref())
for key in self._validator_update_exclude_keys():
schema.pop(key, None)
for key in self._validator_update_non_required_address_keys():
if key in schema:
schema[key]["required"] = False
schema[key]["nullable"] = True
schema.update(
{
"email": {"type": "string", "required": False},
"external_id": {"type": "string", "required": False},
"vat": {"type": "string", "required": False},
"company_name": {"type": "string", "required": False},
"function": {"type": "string", "required": False},
"lang": {"type": "string", "required": False},
}
)
return schema

def _validator_create_exclude_keys(self):
Expand Down

0 comments on commit 7296cbe

Please sign in to comment.