d582f15681
- Implemented tests for import polling functionality, ensuring correct behavior for active and terminal import statuses. - Created tests for the login page, validating user interactions and error handling. - Added unit tests for money utility functions, covering parsing, formatting, and summation of monetary values. - Developed tests for query keys, ensuring proper scoping and invalidation roots. chore: setup testing environment and configuration - Added setup file for testing with Vitest and Testing Library. - Configured TypeScript and Vite for the frontend project. - Created Docker and Nginx configurations for local development and production environments. - Established a PostgreSQL initialization script for setting up application roles. docs: add README and environment configuration for infra - Included README for the infra directory, detailing local development setup and service descriptions. - Created an example environment configuration file for local development with placeholders for sensitive information.
28 lines
904 B
Python
28 lines
904 B
Python
import uuid
|
|
|
|
from app.db.session import session_scope
|
|
from app.exports.service import build_export, purge_due_spaces
|
|
from app.imports.celery_app import celery_app
|
|
|
|
|
|
@celery_app.task(name="exports.build", bind=True, max_retries=2, default_retry_delay=20)
|
|
def build_export_task(self, export_id: str, space_id: str) -> str:
|
|
try:
|
|
with session_scope(uuid.UUID(space_id)) as db:
|
|
build_export(db, space_id=uuid.UUID(space_id), export_id=uuid.UUID(export_id))
|
|
except Exception as exc:
|
|
if self.request.retries < 2:
|
|
raise self.retry(exc=exc) from exc
|
|
raise
|
|
return export_id
|
|
|
|
|
|
def enqueue_export(export_id: uuid.UUID, space_id: uuid.UUID) -> None:
|
|
build_export_task.delay(str(export_id), str(space_id))
|
|
|
|
|
|
@celery_app.task(name="spaces.purge_due")
|
|
def purge_due_spaces_task() -> int:
|
|
with session_scope() as db:
|
|
return purge_due_spaces(db)
|