আমি ভাষী চাঙ্গে কোডিং গাঙ্গে
swadhinbiswas committed 2 years ago
4577b94
1 parent a7d43d8
commit 4577b94
2 files changed
+22 -1
Showing 2 changed files+22-1
▼backend/services/tagservice.py
+0-0
0 | 0 |
▼backend/services/userservice.py
+22-1
| @@ -14,4 +14,25 @@ class UserService: | ||
14 | 14 | userpicture=user.userpicture, |
15 | 15 | gallary=user.gallary, |
16 | 16 | tags=user.tags |
17 | - ) | |
17 | + ) | |
18 | + await user_in.save() | |
19 | + return user_in | |
20 | + @staticmethod | |
21 | + async def get_by_username(username:str)->Optional[UseModel]: | |
22 | + theuser= await UseModel.find_one(UseModel.username==username) | |
23 | + return theuser | |
24 | + | |
25 | + @staticmethod | |
26 | + async def get_by_email(email:str)->Optional[UseModel]: | |
27 | + themailer= await UseModel.find_one(UseModel.email==email) | |
28 | + return themailer | |
29 | + @staticmethod | |
30 | + async def update_user(username:str,update:Upadete)->Optional[UseModel]: | |
31 | + user=await UseModel.find_one(UseModel.username==username) | |
32 | + if user is None: | |
33 | + raise pymongo.errors.OperationFailure("User not found") | |
34 | + await user.update({"$set":user.dict(exclude_unset=True)}) | |
35 | + | |
36 | + return user | |
37 | + | |
38 | + | |
18 | 39 | |