add apprise and send notification when refreshing listings

This commit is contained in:
Viktor Barzin 2025-07-25 21:32:06 +00:00
parent ce386e748d
commit 762408e054
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
6 changed files with 105 additions and 6 deletions

View file

@ -15,6 +15,7 @@ from dotenv import load_dotenv
from fastapi import Depends, FastAPI, HTTPException, Query
from api.auth import User
from models.listing import QueryParameters
from notifications import send_notification
from rec import districts
from redis_repository import RedisRepository
from repositories.listing_repository import ListingRepository
@ -82,6 +83,7 @@ async def refresh_listings(
user: Annotated[User, Depends(get_current_user)],
query_parameters: Annotated[QueryParameters, Query()],
) -> dict[str, str]:
await send_notification(f"{user.email} refreshing listings with query parameters {query_parameters.model_dump_json()}")
# TODO: rate limit
expiry_time = datetime.now() + timedelta(minutes=10)
task = listing_tasks.dump_listings_task.apply_async(