Skip to content

Commit 2225623

Browse files
authored
Update user_service.py
since user_id is referring to the built in _id in MongoDB which is an ObjectId this type hint shouldn't be an int rather a bson.ObjectId right?
1 parent 0815710 commit 2225623

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ch16-mongodb-version/final/pypi_nosql/pypi/services/user_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import bson
12
from typing import Optional
23

34
from pypi import DbSession
@@ -43,7 +44,7 @@ def login_user(email: str, password: str) -> Optional[User]:
4344
return user
4445

4546

46-
def find_user_by_id(user_id: int) -> Optional[User]:
47+
def find_user_by_id(user_id: bson.ObjectId) -> Optional[User]:
4748
return User.objects(id=user_id).first()
4849

4950

0 commit comments

Comments
 (0)