Skip to content

Commit 999b3a9

Browse files
committed
Fixed minor bugs
1 parent fc95fd6 commit 999b3a9

File tree

8 files changed

+62
-77
lines changed

8 files changed

+62
-77
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ dependencies = [
2121
"pyjwt>=2.10.1",
2222
"faststream[rabbit]>=0.5.39",
2323
"starlette>=0.46.2",
24-
"django-extensions>=4.1",
2524
"uvicorn>=0.34.2",
2625
]
2726

src/api/routes/User.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def set_account_pin(request: HttpRequest, user_pin: Pin) -> tuple:
3535
"/",
3636
response={
3737
HTTPStatus.OK: SuccessResponse[UserResponse],
38-
HTTPStatus.BAD_REQUEST: ErrorResponse,
38+
HTTPStatus.NOT_FOUND: ErrorResponse,
3939
HTTPStatus.INTERNAL_SERVER_ERROR: ServerErrorResponse,
4040
},
4141
)

src/api/routes/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ async def home(request: HttpRequest) -> dict:
7070
return {"message": "Hello, World!"}
7171

7272

73-
api.add_router("/users", "src.api.routes.User.router", tags=["User"])
74-
api.add_router("/kyc", "src.api.routes.UserKYC.router", tags=["User KYC"])
73+
api.add_router("/users/profile", "src.api.routes.User.router", tags=["User"])
74+
api.add_router("/users/kyc", "src.api.routes.UserKYC.router", tags=["User KYC"])
7575
api.add_router(
76-
"/next-of-kin",
76+
"/users/next-of-kin",
7777
"src.api.routes.UserNOK.router",
7878
tags=["User NOK"],
7979
)
8080
api.add_router(
81-
"/withdrawal-accounts",
81+
"/users/withdrawal-accounts",
8282
"src.api.routes.WithdrawalAccount.router",
8383
tags=["User"],
8484
)

src/api/services/UserService.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,11 @@ async def update(self, id: str, req: UpdateUserRequest) -> UserSuccess:
105105
id, req.model_dump(exclude_unset=True)
106106
)
107107

108+
message = MESSAGES["USER"]["UPDATED"]
108109
self.logger.info(
109110
{
110111
"activity_type": ACTIVITY_TYPES["UPDATE_USER"],
111-
"message": MESSAGES["USER"]["UPDATED"],
112+
"message": message,
112113
"metadata": {
113114
"user": {"id": id},
114115
"new_data": req.model_dump(exclude_unset=True),
@@ -117,7 +118,7 @@ async def update(self, id: str, req: UpdateUserRequest) -> UserSuccess:
117118
)
118119
user = self.utility_service.sanitize_user_object(updated_user)
119120

120-
return {"is_success": True, "user": user}
121+
return {"is_success": True, "message": message, "user": user}
121122

122123
@staticmethod
123124
@UserRouter.subscriber(queue=QUEUE_NAMES["USER_REGISTRATION"])

src/api/services/UtilityService.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import hashlib
33
from uuid import uuid4
44
from typing import TypedDict
5-
from datetime import datetime, timedelta
5+
from datetime import UTC, datetime, timedelta
66

77
import jwt
88
import bcrypt
@@ -123,10 +123,10 @@ def verify_signature(signature_data: SignatureData, logger: Logger) -> bool:
123123
)
124124
raise AuthenticationError(message=message)
125125

126-
initial_time = datetime.fromtimestamp(float(timestamp) / 1000)
126+
initial_time = datetime.fromtimestamp(float(timestamp), UTC)
127127
valid_window = initial_time + timedelta(minutes=ttl)
128128

129-
if valid_window < datetime.now():
129+
if valid_window < datetime.now(UTC):
130130
message = "Signature expired!"
131131
logger.error(
132132
{
@@ -141,5 +141,5 @@ def verify_signature(signature_data: SignatureData, logger: Logger) -> bool:
141141

142142
@staticmethod
143143
def get_timestamp() -> str:
144-
current_time = datetime.now().timestamp() * 1000
144+
current_time = datetime.now(UTC).timestamp()
145145
return str(current_time)

src/config/apps.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
THIRD_PARTY_APPS = [
1515
"corsheaders",
16-
"django_extensions",
1716
]
1817

1918
INSTALLED_APPS = [

src/env.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ class Queue(TypedDict):
118118
}
119119

120120
queue: Queue = {
121-
"key": get_env_str("QUEUE_SECRECT_KEY"),
122-
"ttl": get_env_float("QUEUE_SECRECT_KEY_TTL"),
121+
"key": get_env_str("QUEUE_SECRET_KEY"),
122+
"ttl": get_env_float("QUEUE_SECRET_KEY_TTL"),
123123
}
124124

125125
otp: OTP = {"lifetime": get_env_int("OTP_LIFETIME")}

uv.lock

Lines changed: 48 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)