Skip to content

Commit ad0a485

Browse files
committed
fix: serialization issue with uuid not supported for tasks
1 parent cf4868b commit ad0a485

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/labs/routers/auth/tasks.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from uuid import UUID
21
from sqlalchemy.ext.asyncio import AsyncSession
3-
from taskiq import TaskiqDepends
2+
from taskiq_dependencies import Depends
43

54
from ...db import get_async_session
65
from ...email import sender
@@ -9,15 +8,16 @@
98

109
from ...models import User
1110

11+
1212
@broker.task
1313
async def send_reset_password_email(
14-
user_id: UUID,
15-
session: AsyncSession = TaskiqDepends(get_async_session)
14+
user_id: str,
15+
session: AsyncSession = Depends(get_async_session)
1616
) -> None:
1717
user = await User.get(session, user_id)
1818

1919
# Create a verification code, this is available
20-
# only at the time of calling this
20+
# only at the time of calling this
2121
reset_password_token = await user.get_verification_token(session)
2222

2323
sender.send(
@@ -32,16 +32,17 @@ async def send_reset_password_email(
3232
},
3333
)
3434

35+
3536
@broker.task
3637
async def send_account_verification_email(
37-
user_id: UUID,
38-
session: AsyncSession = TaskiqDepends(get_async_session)
38+
user_id: str,
39+
session: AsyncSession = Depends(get_async_session)
3940
) -> None:
4041

4142
user = await User.get(session, user_id)
4243

4344
# Create a verification code, this is available
44-
# only at the time of calling this
45+
# only at the time of calling this
4546
verification_token = await user.get_verification_token(session)
4647

4748
sender.send(
@@ -56,25 +57,27 @@ async def send_account_verification_email(
5657
},
5758
)
5859

60+
5961
@broker.task
6062
async def send_welcome_email(
61-
user_id: UUID,
62-
session: AsyncSession = TaskiqDepends(get_async_session)
63+
user_id: str,
64+
session: AsyncSession = Depends(get_async_session)
6365
) -> None:
6466
user = await User.get(session, user_id)
6567

6668

6769
@broker.task
6870
async def send_otp_sms(
69-
user_id: UUID,
70-
session: AsyncSession = TaskiqDepends(get_async_session)
71+
user_id: str,
72+
session: AsyncSession = Depends(get_async_session)
7173
) -> None:
7274
user = await User.get(session, user_id)
7375

76+
7477
@broker.task
7578
async def send_otp_email(
76-
user_id: UUID,
77-
session: AsyncSession = TaskiqDepends(get_async_session)
79+
user_id: str,
80+
session: AsyncSession = Depends(get_async_session)
7881
) -> None:
7982
"""
8083
Generates the OTP for a user and email it to them
@@ -85,8 +88,8 @@ async def send_otp_email(
8588
user = await User.get(session, user_id)
8689

8790
otp = user.get_otp(
88-
digits = settings.verbosity.totp_length,
89-
timeout = settings.lifetime.totp_token,
91+
digits=settings.verbosity.totp_length,
92+
timeout=settings.lifetime.totp_token,
9093
)
9194

9295
sender.send(
@@ -99,5 +102,3 @@ async def send_otp_email(
99102
"user": user,
100103
},
101104
)
102-
103-

src/labs/routers/upload/tasks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from uuid import UUID
21
from sqlalchemy.ext.asyncio import AsyncSession
32
from taskiq import TaskiqDepends
43

@@ -9,7 +8,7 @@
98

109
@broker.task
1110
async def verify_s3_file_availability(
12-
s3_file_metadata_id: UUID,
11+
s3_file_metadata_id: str,
1312
session: AsyncSession = TaskiqDepends(get_async_session)
1413
) -> None:
1514
pass

0 commit comments

Comments
 (0)