Feat/mobile user crud block auth#29
Conversation
Fix/docker ghcr
wailbentafat
left a comment
There was a problem hiding this comment.
fix merge confilict also
app/router/web/users.py
Outdated
| def _to_admin_user_schema(user: User) -> AdminUserSchema: | ||
| return AdminUserSchema( | ||
| id=user.id, |
There was a problem hiding this comment.
remove this from logique router
app/service/users.py
Outdated
| return updated | ||
|
|
||
| return user | ||
| except HTTPException: |
There was a problem hiding this comment.
we dont have any http request why we check http request excceptions ?
app/service/users.py
Outdated
|
|
||
| if await is_session_blacklisted(redis, session_id): | ||
| raise AppException.unauthorized("Token is blacklisted") | ||
|
|
There was a problem hiding this comment.
when we block user the db is our source of truth we just need one check so just remove this
app/service/users.py
Outdated
| session_id: str, | ||
| ) -> bool: | ||
| if await is_session_blacklisted(redis, session_id): | ||
| return False |
There was a problem hiding this comment.
here make the db ur source of truth mean check the db not redis
app/service/users.py
Outdated
| if not user: | ||
| raise AppException.internal_error("Failed to update user") | ||
| return user | ||
| except HTTPException: |
There was a problem hiding this comment.
same no http request
app/service/users.py
Outdated
| logger.error("Failed to update user: %s", exc) | ||
| raise DBException.handle(exc) | ||
|
|
||
| async def delete_user(self, *, user_id: uuid.UUID) -> User: |
There was a problem hiding this comment.
when delete user if he have session remove it from redis
app/core/token_blacklist.py
Outdated
| from app.core.constant import RedisKey | ||
| from app.infra.redis import RedisClient | ||
|
|
||
|
|
There was a problem hiding this comment.
this behaviour is wrong when we use session our source of truth is the database so when we check the database the user is blocked so when we block user we just remove the session from redis when we remove session from redis the code have to check the db and they found out that tht user is blocked this is the right behaviour
5de2b46 to
5aa0cb8
Compare
Summary