|
1 | 1 | from typing import Annotated |
2 | 2 |
|
3 | | -from src.utils.svcs import Service |
4 | | -from src.config.asgi import broker |
5 | | -from src.utils.logger import Logger |
6 | | -from src.api.typing.JWT import JWTSuccess |
7 | | -from src.api.typing.UserExists import UserExists |
8 | | -from src.api.constants.messages import MESSAGES, DYNAMIC_MESSAGES |
9 | | -from src.api.typing.UserSuccess import UserSuccess |
10 | 3 | from src.api.constants.activity_types import ACTIVITY_TYPES |
| 4 | +from src.api.constants.messages import DYNAMIC_MESSAGES, MESSAGES |
| 5 | +from src.api.constants.queues import QUEUE_NAMES |
| 6 | +from src.api.models.payload.requests.AuthenticateUserOtp import \ |
| 7 | + AuthenticateUserOtp |
| 8 | +from src.api.models.payload.requests.AuthenticateUserRequest import \ |
| 9 | + AuthenticateUserRequest |
| 10 | +from src.api.models.payload.requests.ChangeUserPasswordRequest import \ |
| 11 | + ChangeUserPasswordRequest |
| 12 | +from src.api.models.payload.requests.CreateUserRequest import CreateUserRequest |
11 | 13 | from src.api.models.payload.requests.JWT import JWT |
12 | | -from src.api.repositories.UserRepository import UserRepository |
13 | 14 | from src.api.models.payload.requests.ResendUserOtp import ResendUserOtp |
14 | | -from src.api.models.payload.requests.CreateUserRequest import CreateUserRequest |
15 | | -from src.api.models.payload.requests.AuthenticateUserOtp import AuthenticateUserOtp |
16 | | -from src.api.models.payload.requests.AuthenticateUserRequest import ( |
17 | | - AuthenticateUserRequest, |
18 | | -) |
19 | | -from src.api.models.payload.requests.ChangeUserPasswordRequest import ( |
20 | | - ChangeUserPasswordRequest, |
21 | | -) |
| 15 | +from src.api.repositories.UserRepository import UserRepository |
| 16 | +from src.api.typing.JWT import JWTSuccess |
| 17 | +from src.api.typing.UserExists import UserExists |
| 18 | +from src.api.typing.UserSuccess import UserSuccess |
| 19 | +from src.config.asgi import broker |
| 20 | +from src.utils.logger import Logger |
| 21 | +from src.utils.svcs import Service |
22 | 22 |
|
23 | 23 | from .OtpService import OtpService |
24 | 24 | from .UtilityService import UtilityService |
@@ -62,7 +62,7 @@ async def register(self, req: CreateUserRequest) -> UserExists: |
62 | 62 | created_user = await UserRepository.add(req) |
63 | 63 |
|
64 | 64 | user_data = {"id": created_user.id, "email": created_user.email} |
65 | | - queue = "create-user" |
| 65 | + queue = QUEUE_NAMES["USER_REGISTRATION"] |
66 | 66 |
|
67 | 67 | await broker.publish(message=user_data, queue=queue, persist=True) |
68 | 68 |
|
@@ -126,8 +126,9 @@ async def validate_email(self, req: AuthenticateUserOtp) -> bool: |
126 | 126 | await UserRepository.update_by_user( |
127 | 127 | user, {"is_active": True, "is_enabled": True, "is_validated": True} |
128 | 128 | ) |
| 129 | + |
129 | 130 | user_data = {"id": user.id, "email": user.email} |
130 | | - queue = "validate-user" |
| 131 | + queue = QUEUE_NAMES["EMAIL_VALIDATION"] |
131 | 132 | await broker.publish(message=user_data, queue=queue, persist=True) |
132 | 133 |
|
133 | 134 | return True |
|
0 commit comments