11"""Module for users endpoints."""
22
3- from typing import Annotated , Any , Type
3+ from typing import Annotated , Any
44from uuid import UUID
55
66from fastapi import APIRouter , BackgroundTasks , Depends , HTTPException , Path , status
77from fastapi_utils .cbv import cbv
88
9- from app .api .deps import CurrentUser , CurrentSuperuser , ItemCRUDDep , UserCRUDDep
9+ from app .api .deps import CurrentUser , CurrentSuperuser , ItemCrudDep , UserCrudDep
1010from app .core .config import get_settings , Settings
1111from app .core .emails import EmailManager , get_email_manager
1212from app .core .security import get_security_manager , SecurityManager
2424
2525__all__ : tuple [str ] = ("users_router" ,)
2626
27- EmailManagerDep : Type [ EmailManager ] = Annotated [EmailManager , Depends (get_email_manager )]
28- SettingsDep : Type [ Settings ] = Annotated [Settings , Depends (get_settings )]
29- SecurityManagerDep : Type [ SecurityManager ] = Annotated [SecurityManager , Depends (get_security_manager )]
30- UserIDDep : Type [ UUID ] = Annotated [UUID , Path (alias = "id" , description = "User ID" )]
27+ EmailManagerDep = Annotated [EmailManager , Depends (get_email_manager )]
28+ SettingsDep = Annotated [Settings , Depends (get_settings )]
29+ SecurityManagerDep = Annotated [SecurityManager , Depends (get_security_manager )]
30+ UserIdDep = Annotated [UUID , Path (alias = "id" , description = "User ID" )]
3131
3232users_router : APIRouter = APIRouter ()
3333
3636class UsersRouter :
3737 """Class-based view for user endpoints."""
3838
39- def __init__ (self , user_crud : UserCRUDDep ) -> None :
39+ def __init__ (self , user_crud : UserCrudDep ) -> None :
4040 """
4141 Initializes the UsersRouter class with the necessary dependencies.
4242
4343 :param user_crud: Dependency for user CRUD operations.
4444 """
45- self ._user_crud : UserCRUDDep = user_crud
45+ self ._user_crud : UserCrudDep = user_crud
4646
4747 @users_router .get (
4848 path = "/" ,
@@ -209,7 +209,7 @@ async def register_user(self, user_in: UserRegister) -> User:
209209 @users_router .get (
210210 path = "/{id}" , response_model = UserPublic , summary = "Read User by ID" , description = "Retrieving user data by ID."
211211 )
212- async def read_user_by_id (self , user_id : UserIDDep , current_user : CurrentUser ) -> User :
212+ async def read_user_by_id (self , user_id : UserIdDep , current_user : CurrentUser ) -> User :
213213 """
214214 Endpoint to retrieve a user's data by their ID.
215215
@@ -233,7 +233,7 @@ async def read_user_by_id(self, user_id: UserIDDep, current_user: CurrentUser) -
233233 summary = "Update User by ID" ,
234234 description = "Update user by ID (for superusers only)." ,
235235 )
236- async def update_user (self , user_id : UserIDDep , user_in : UserUpdate , _ : CurrentSuperuser ) -> User :
236+ async def update_user (self , user_id : UserIdDep , user_in : UserUpdate , _ : CurrentSuperuser ) -> User :
237237 """
238238 Endpoint to update a user by their ID. Requires superuser privileges.
239239
@@ -262,7 +262,7 @@ async def update_user(self, user_id: UserIDDep, user_in: UserUpdate, _: CurrentS
262262 description = "Delete a user by their ID (superusers only)." ,
263263 )
264264 async def delete_user (
265- self , user_id : UserIDDep , item_crud : ItemCRUDDep , current_superuser : CurrentSuperuser
265+ self , user_id : UserIdDep , item_crud : ItemCrudDep , current_superuser : CurrentSuperuser
266266 ) -> Message :
267267 """
268268 Endpoint to delete a user by their ID. Requires superuser privileges.
0 commit comments