28
28
from app .logging .logging_constants import LOGGING_AUTH_SERVICE
29
29
from app .logging .logging_schema import SpotifyElectronLogger
30
30
from app .spotify_electron .login .login_schema import InvalidCredentialsLoginException
31
- from app .spotify_electron .user .user . user_schema import (
32
- UserDTO ,
33
- UserNotFoundException ,
34
- UserServiceException ,
31
+ from app .spotify_electron .user .base_user_schema import (
32
+ BaseUserDTO ,
33
+ BaseUserNotFoundException ,
34
+ BaseUserServiceException ,
35
35
)
36
36
from app .spotify_electron .utils .validations .validation_utils import validate_parameter
37
37
@@ -132,7 +132,7 @@ def get_jwt_token_data(
132
132
133
133
def get_current_user (
134
134
token : TokenData ,
135
- ) -> UserDTO :
135
+ ) -> BaseUserDTO :
136
136
"""Get current user from JWT Token
137
137
138
138
Args:
@@ -141,7 +141,7 @@ def get_current_user(
141
141
142
142
Raises:
143
143
------
144
- UserNotFoundException : token user not found
144
+ BaseUserNotFoundException : token user not found
145
145
JWTGetUserException: if error while retrieving user from token
146
146
Returns:
147
147
Artist | User: the user or artist associated with the JWT Token
@@ -151,9 +151,9 @@ def get_current_user(
151
151
jwt_username = token .username
152
152
153
153
user = base_user_service .get_user (jwt_username )
154
- except UserNotFoundException as exception :
154
+ except BaseUserNotFoundException as exception :
155
155
auth_service_logger .exception (f"User { jwt_username } not found" )
156
- raise UserNotFoundException from exception
156
+ raise BaseUserNotFoundException from exception
157
157
except Exception as exception :
158
158
auth_service_logger .exception (f"Unexpected exception getting user from token { token } " )
159
159
raise JWTGetUserException from exception
@@ -218,7 +218,7 @@ def login_user(name: str, password: str) -> str:
218
218
------
219
219
InvalidCredentialsLoginException: bad user credentials
220
220
VerifyPasswordException: failing authenticating user and password
221
- UserNotFoundException : user doesn't exists
221
+ BaseUserNotFoundException : user doesn't exists
222
222
UnexpectedLoginUserException: unexpected error during user login
223
223
224
224
Returns:
@@ -252,10 +252,10 @@ def login_user(name: str, password: str) -> str:
252
252
except CreateJWTException as exception :
253
253
auth_service_logger .exception (f"Error creating JWT Token from data: { jwt_data } " )
254
254
raise VerifyPasswordException from exception
255
- except UserNotFoundException as exception :
255
+ except BaseUserNotFoundException as exception :
256
256
auth_service_logger .exception (f"User { name } doesn't exists" )
257
- raise UserNotFoundException from exception
258
- except UserServiceException as exception :
257
+ raise BaseUserNotFoundException from exception
258
+ except BaseUserServiceException as exception :
259
259
auth_service_logger .exception (
260
260
f"Unexpected error in User service while login user: { name } "
261
261
)
@@ -276,7 +276,7 @@ def login_user_with_token(raw_token: str) -> None:
276
276
277
277
Raises:
278
278
JWTValidationException: invalid JWT credentials
279
- UserNotFoundException : user doesn't exists
279
+ BaseUserNotFoundException : user doesn't exists
280
280
UnexpectedLoginUserException: unexpected error during user login
281
281
"""
282
282
try :
@@ -288,10 +288,10 @@ def login_user_with_token(raw_token: str) -> None:
288
288
except (JWTValidationException , BadJWTTokenProvidedException ) as exception :
289
289
auth_service_logger .exception (f"Error validating jwt token data: { raw_token } " )
290
290
raise JWTValidationException from exception
291
- except UserNotFoundException as exception :
291
+ except BaseUserNotFoundException as exception :
292
292
auth_service_logger .exception (f"User { token_data .username } not found" )
293
- raise UserNotFoundException from exception
294
- except UserServiceException as exception :
293
+ raise BaseUserNotFoundException from exception
294
+ except BaseUserServiceException as exception :
295
295
auth_service_logger .exception (
296
296
f"Unexpected error in User service while auto login user: { token_data .username } "
297
297
)
0 commit comments