15 lines
		
	
	
		
			408 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			408 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from sqlalchemy import select
 | 
						|
 | 
						|
from models import Role
 | 
						|
from schemas.role import *
 | 
						|
from services.base import BaseService
 | 
						|
 | 
						|
 | 
						|
class RoleService(BaseService):
 | 
						|
    async def get_all(self) -> GetAllRolesResponse:
 | 
						|
        stmt = (select(Role).order_by(Role.key))
 | 
						|
        roles = (await self.session.scalars(stmt)).all()
 | 
						|
        return GetAllRolesResponse(
 | 
						|
            roles=RoleSchema.from_orm_list(roles)
 | 
						|
        )
 |