You've already forked RekomenciBackend
fix mypy
This commit is contained in:
@@ -4,7 +4,7 @@ from typing import override
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
from template_project.adapters.data_gateways.tables import resume_prediction_table
|
from template_project.adapters.data_gateways.tables import resume_prediction_table, resume_table
|
||||||
from template_project.application.resume.data_gateway import ResumeDataGateway, ResumePredictionDataGateway
|
from template_project.application.resume.data_gateway import ResumeDataGateway, ResumePredictionDataGateway
|
||||||
from template_project.application.resume.entity import Resume, ResumeEmbeddingId, ResumeId, ResumePrediction
|
from template_project.application.resume.entity import Resume, ResumeEmbeddingId, ResumeId, ResumePrediction
|
||||||
from template_project.application.resume.errors import ResumeNotFoundError
|
from template_project.application.resume.errors import ResumeNotFoundError
|
||||||
@@ -31,7 +31,7 @@ class DefaultResumeDataGateway(ResumeDataGateway):
|
|||||||
async def list_by_user_id(self, user_id: UserId, limit: int, offset: int) -> Sequence[Resume]:
|
async def list_by_user_id(self, user_id: UserId, limit: int, offset: int) -> Sequence[Resume]:
|
||||||
statement = (
|
statement = (
|
||||||
select(Resume)
|
select(Resume)
|
||||||
.where(Resume.user_id == user_id)
|
.where(resume_table.c.user_id == user_id)
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
)
|
)
|
||||||
@@ -42,8 +42,8 @@ class DefaultResumeDataGateway(ResumeDataGateway):
|
|||||||
async def list_latest_by_user_id(self, user_id: UserId, limit: int, offset: int) -> Sequence[Resume]:
|
async def list_latest_by_user_id(self, user_id: UserId, limit: int, offset: int) -> Sequence[Resume]:
|
||||||
statement = (
|
statement = (
|
||||||
select(Resume)
|
select(Resume)
|
||||||
.where(Resume.user_id == user_id)
|
.where(resume_table.c.user_id == user_id)
|
||||||
.where(Resume.up_resume_id.is_(None))
|
.where(resume_table.c.up_resume_id.is_(None))
|
||||||
.limit(limit)
|
.limit(limit)
|
||||||
.offset(offset)
|
.offset(offset)
|
||||||
)
|
)
|
||||||
@@ -52,6 +52,7 @@ class DefaultResumeDataGateway(ResumeDataGateway):
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
async def get_history(self, resume_id: ResumeId) -> Sequence[Resume]:
|
async def get_history(self, resume_id: ResumeId) -> Sequence[Resume]:
|
||||||
|
# TODO: N+1
|
||||||
history: list[Resume] = []
|
history: list[Resume] = []
|
||||||
current_resume = await self.load(resume_id)
|
current_resume = await self.load(resume_id)
|
||||||
history.append(current_resume)
|
history.append(current_resume)
|
||||||
|
|||||||
Reference in New Issue
Block a user