mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 02:53:06 +00:00 
			
		
		
		
	feat: api route to get api client infos
This commit is contained in:
		
							
								
								
									
										16
									
								
								api/api.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								api/api.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
from ninja_extra import ControllerBase, api_controller, route
 | 
			
		||||
 | 
			
		||||
from api.auth import ApiKeyAuth
 | 
			
		||||
from api.schemas import ApiClientSchema
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@api_controller("/client")
 | 
			
		||||
class ApiClientController(ControllerBase):
 | 
			
		||||
    @route.get(
 | 
			
		||||
        "/me",
 | 
			
		||||
        auth=[ApiKeyAuth()],
 | 
			
		||||
        response=ApiClientSchema,
 | 
			
		||||
        url_name="api-client-infos",
 | 
			
		||||
    )
 | 
			
		||||
    def get_client_info(self):
 | 
			
		||||
        return self.context.request.auth
 | 
			
		||||
		Reference in New Issue
	
	Block a user