23 lines
629 B
Python
23 lines
629 B
Python
from typing import List
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.application.industries_repository import IndustriesRepository
|
|
from app.domain.entities.industries import IndustryRead
|
|
|
|
|
|
class IndustriesService:
|
|
def __init__(self, db: AsyncSession):
|
|
self.industries_repository = IndustriesRepository(db)
|
|
|
|
async def get_all(self) -> List[IndustryRead]:
|
|
industries = await self.industries_repository.get_all()
|
|
response = []
|
|
|
|
for industry in industries:
|
|
response.append(IndustryRead.model_validate(
|
|
industry
|
|
))
|
|
|
|
return response
|