feat: fetch views manually and worker
This commit is contained in:
@@ -358,3 +358,17 @@ class Postgres(DatabaseBase):
|
||||
|
||||
result = await self.session.execute(stmt)
|
||||
return list(result.scalars().all())
|
||||
|
||||
async def get_active_purchases_with_urls(self) -> list[domain.Purchase]:
|
||||
stmt = (
|
||||
select(domain.Purchase)
|
||||
.where(
|
||||
domain.Purchase.status == domain.PurchaseStatus.ACTIVE,
|
||||
domain.Purchase.ad_post_url.isnot(None),
|
||||
domain.Purchase.views_availability != domain.PostViewsAvailability.MANUAL,
|
||||
)
|
||||
.order_by(domain.Purchase.created_at.asc())
|
||||
)
|
||||
|
||||
result = await self.session.execute(stmt)
|
||||
return list(result.scalars().all())
|
||||
|
||||
Reference in New Issue
Block a user