Skip to content

Commit 4e56161

Browse files
committed
feat: make jwtSubject field optional in authorized user serialization
1 parent ed366d2 commit 4e56161

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

unit/models/codecs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,10 @@ def default(self, obj):
459459
if isinstance(obj, BusinessContact):
460460
return {"fullName": obj.full_name, "email": obj.email, "phone": obj.phone}
461461
if isinstance(obj, AuthorizedUser):
462-
return {"fullName": obj.full_name, "email": obj.email, "phone": obj.phone, "jwtSubject": obj.jwt_subject}
462+
authorized_user = {"fullName": obj.full_name, "email": obj.email, "phone": obj.phone}
463+
if obj.jwt_subject is not None:
464+
authorized_user["jwtSubject"] = obj.jwt_subject
465+
return authorized_user
463466
if isinstance(obj, Officer):
464467
officer = {"fullName": obj.full_name, "dateOfBirth": date_utils.to_date_str(obj.date_of_birth),
465468
"address": obj.address, "phone": obj.phone, "email": obj.email}

0 commit comments

Comments
 (0)