Skip to content

Commit d1aa75e

Browse files
committed
feat: add jwt subject to authorized user entity
1 parent f4ae236 commit d1aa75e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

unit/models/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,18 +332,19 @@ def from_json_api(l: List):
332332

333333

334334
class AuthorizedUser(UnitDTO):
335-
def __init__(self, full_name: FullName, email: str, phone: Phone):
335+
def __init__(self, full_name: FullName, email: str, phone: Phone, jwt_subject: Optional[str] = None):
336336
self.full_name = full_name
337337
self.email = email
338338
self.phone = phone
339+
self.jwt_subject = jwt_subject
339340

340341
@staticmethod
341342
def from_json_api(l: List) -> List:
342343
authorized_users = []
343344
for data in l:
344345
authorized_users.append(
345346
AuthorizedUser(
346-
data.get("fullName"), data.get("email"), data.get("phone")
347+
data.get("fullName"), data.get("email"), data.get("phone"), data.get("jwtSubject")
347348
)
348349
)
349350
return authorized_users

unit/models/codecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ 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}
462+
return {"fullName": obj.full_name, "email": obj.email, "phone": obj.phone, "jwtSubject": obj.jwt_subject}
463463
if isinstance(obj, Officer):
464464
officer = {"fullName": obj.full_name, "dateOfBirth": date_utils.to_date_str(obj.date_of_birth),
465465
"address": obj.address, "phone": obj.phone, "email": obj.email}

0 commit comments

Comments
 (0)