Fixed error and dto handling #70

This commit is contained in:
Sven Heidemann 2022-10-15 09:32:41 +02:00
parent e0844a7f92
commit 5cd91d8341
9 changed files with 66 additions and 66 deletions

View File

@ -82,21 +82,21 @@ class AuthUserDTO(DtoABC):
self.auth_role = value
def from_dict(self, values: dict):
self._id = values['Id']
self._first_name = values['FirstName']
self._last_name = values['LastName']
self._email = values['EMail']
self._password = values['Password']
self._is_confirmed = values['IsConfirmed']
self._auth_role = values['AuthRole']
self._id = values['id']
self._first_name = values['firstName']
self._last_name = values['lastName']
self._email = values['email']
self._password = values['password']
self._is_confirmed = values['isConfirmed']
self._auth_role = values['authRole']
def to_dict(self) -> dict:
return {
"Id": self._id,
"FirstName": self._first_name,
"LastName": self._last_name,
"EMail": self._email,
"Password": self._password,
"IsConfirmed": self._is_confirmed,
"AuthRole": self._auth_role,
'id': self._id,
'firstName': self._first_name,
'lastName': self._last_name,
'email': self._email,
'password': self._password,
'isConfirmed': self._is_confirmed,
'authRole': self._auth_role,
}

View File

@ -11,11 +11,11 @@ class AuthUserFilteredResultDTO(DtoABC, FilteredResult):
FilteredResult.__init__(self, result, total_count)
def from_dict(self, values: dict):
self._result = values['Users']
self._total_count = values['TotalCount']
self._result = values['users']
self._total_count = values['totalCount']
def to_dict(self) -> dict:
return {
'Users': self.result,
'TotalCount': self.total_count
'users': self.result,
'totalCount': self.total_count
}

View File

@ -13,9 +13,9 @@ class EMailStringDTO(DtoABC):
self._email = email
def from_dict(self, values: dict):
self._email = values['EMail']
self._email = values['email']
def to_dict(self) -> dict:
return {
'EMail': self._email
'email': self._email
}

View File

@ -29,6 +29,6 @@ class ErrorDTO(DtoABC):
def to_dict(self) -> dict:
return {
'ErrorCode': int(self._error_code.value),
'Message': self._message
'errorCode': int(self._error_code.value),
'message': self._message
}

View File

@ -22,11 +22,11 @@ class ResetPasswordDTO(DtoABC):
return self._password
def from_dict(self, values: dict):
self._id = values['Id']
self._password = values['Password']
self._id = values['id']
self._password = values['password']
def to_dict(self) -> dict:
return {
'Id': self._id,
'Password': self._password
'id': self._id,
'password': self._password
}

View File

@ -37,31 +37,31 @@ class SettingsDTO(DtoABC):
self._mail_transceiver_address = mail_transceiver_address
def from_dict(self, values: dict):
self._web_version = values['WebVersion']
self._api_version.from_dict(values['ApiVersion'])
self._config_path = values['ConfigPath']
self._web_base_url = values['WebBaseURL']
self._api_base_url = values['ApiBaseURL']
self._token_expire_time = values['TokenExpireTime']
self._refresh_token_expire_time = values['RefreshTokenExpireTime']
self._mail_user = values['MailUser']
self._mail_port = values['MailPort']
self._mail_host = values['MailHost']
self._mail_transceiver = values['MailTransceiver']
self._mail_transceiver_address = values['MailTransceiverAddress']
self._web_version = values['webVersion']
self._api_version.from_dict(values['apiVersion'])
self._config_path = values['configPath']
self._web_base_url = values['webBaseURL']
self._api_base_url = values['apiBaseURL']
self._token_expire_time = values['tokenExpireTime']
self._refresh_token_expire_time = values['refreshTokenExpireTime']
self._mail_user = values['mailUser']
self._mail_port = values['mailPort']
self._mail_host = values['mailHost']
self._mail_transceiver = values['mailTransceiver']
self._mail_transceiver_address = values['mailTransceiverAddress']
def to_dict(self) -> dict:
return {
'WebVersion': self._web_version,
'ApiVersion': self._api_version.to_dict(),
'ConfigPath': self._config_path,
'WebBaseURL': self._web_base_url,
'ApiBaseURL': self._api_base_url,
'TokenExpireTime': self._token_expire_time,
'RefreshTokenExpireTime': self._refresh_token_expire_time,
'MailUser': self._mail_user,
'MailPort': self._mail_port,
'MailHost': self._mail_host,
'MailTransceiver': self._mail_transceiver,
'MailTransceiverAddress': self._mail_transceiver_address,
'webVersion': self._web_version,
'apiVersion': self._api_version.to_dict(),
'configPath': self._config_path,
'webBaseURL': self._web_base_url,
'apiBaseURL': self._api_base_url,
'tokenExpireTime': self._token_expire_time,
'refreshTokenExpireTime': self._refresh_token_expire_time,
'mailUser': self._mail_user,
'mailPort': self._mail_port,
'mailHost': self._mail_host,
'mailTransceiver': self._mail_transceiver,
'mailTransceiverAddress': self._mail_transceiver_address,
}

View File

@ -22,11 +22,11 @@ class TokenDTO(DtoABC):
return self._refresh_token
def from_dict(self, values: dict):
self._token = values['Token']
self._refresh_token = values['RefreshToken']
self._token = values['token']
self._refresh_token = values['refreshToken']
def to_dict(self) -> dict:
return {
'Token': self._token,
'RefreshToken': self._refresh_token
'token': self._token,
'refreshToken': self._refresh_token
}

View File

@ -33,13 +33,13 @@ class UpdateAuthUserDTO(DtoABC):
return self._change_password
def from_dict(self, values: dict):
self._auth_user = values['AuthUser']
self._new_auth_user = values['NewAuthUser']
self._change_password = False if 'ChangePassword' not in values else values['ChangePassword']
self._auth_user = values['authUser']
self._new_auth_user = values['newAuthUser']
self._change_password = False if 'changePassword' not in values else values['changePassword']
def to_dict(self) -> dict:
return {
'AuthUser': self._auth_user,
'NewAuthUser': self._new_auth_user,
'ChangePassword': self._change_password
'authUser': self._auth_user,
'newAuthUser': self._new_auth_user,
'changePassword': self._change_password
}

View File

@ -15,13 +15,13 @@ class VersionDTO(DtoABC):
self._micro = micro
def from_dict(self, values: dict):
self._major = values['Major']
self._minor = values['Minor']
self._micro = values['Micro']
self._major = values['major']
self._minor = values['minor']
self._micro = values['micro']
def to_dict(self) -> dict:
return {
'Major': self._major,
'Minor': self._minor,
'Micro': self._micro,
'major': self._major,
'minor': self._minor,
'micro': self._micro,
}