chore: claude final touches
This commit is contained in:
@@ -35,6 +35,31 @@ class JobRepository:
|
||||
)
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
async def list_active_by_type(
|
||||
self,
|
||||
*,
|
||||
requester: User,
|
||||
job_type: str,
|
||||
project_id: uuid.UUID | None,
|
||||
statuses: tuple[str, ...],
|
||||
) -> list[Job]:
|
||||
stmt: Select[tuple[Job]] = (
|
||||
select(Job)
|
||||
.where(Job.is_active.is_(True))
|
||||
.where(Job.user_id == requester.id)
|
||||
.where(Job.job_type == job_type)
|
||||
.where(Job.status.in_(statuses))
|
||||
.order_by(Job.created_at.desc())
|
||||
)
|
||||
|
||||
if project_id is None:
|
||||
stmt = stmt.where(Job.project_id.is_(None))
|
||||
else:
|
||||
stmt = stmt.where(Job.project_id == project_id)
|
||||
|
||||
result = await self._session.execute(stmt)
|
||||
return list(result.scalars().all())
|
||||
|
||||
async def create(self, *, requester: User, data: JobCreate) -> Job:
|
||||
job = Job(
|
||||
user_id=requester.id,
|
||||
|
||||
Reference in New Issue
Block a user