feat: deal tags
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from models import DealTag
|
||||
from models.project import Project
|
||||
from repositories.built_in_module import BuiltInModuleRepository
|
||||
from repositories.mixins import *
|
||||
@ -12,11 +13,17 @@ class ProjectRepository(
|
||||
entity_class = Project
|
||||
entity_not_found_msg = "Проект не найден"
|
||||
|
||||
def _apply_options(self, stmt: Select) -> Select:
|
||||
return stmt.options(
|
||||
selectinload(Project.boards),
|
||||
selectinload(Project.tags).joinedload(DealTag.tag_color),
|
||||
)
|
||||
|
||||
def _process_get_all_stmt(self, stmt: Select) -> Select:
|
||||
return stmt.order_by(Project.id)
|
||||
return self._apply_options(stmt).order_by(Project.id)
|
||||
|
||||
def _process_get_by_id_stmt(self, stmt: Select) -> Select:
|
||||
return stmt.options(selectinload(Project.boards))
|
||||
return self._apply_options(stmt)
|
||||
|
||||
async def update(self, project: Project, data: UpdateProjectSchema) -> Project:
|
||||
if data.built_in_modules is not None:
|
||||
|
||||
Reference in New Issue
Block a user