hotpocket/services/backend/hotpocket_backend/apps/ui/tasks.py
Tomek Wójcik 8b86145519 BTHLABS-61: Service layer refactoring
A journey to fix `ValidationError` in Pocket imports turned service
layer refactoring :D
2025-10-12 20:54:00 +02:00

29 lines
751 B
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
import logging
import uuid
from celery import shared_task
LOGGER = logging.getLogger(__name__)
@shared_task
def import_from_pocket(*,
job: str,
account_uuid: uuid.UUID,
csv_path: str,
) -> list[tuple[uuid.UUID, uuid.UUID]]:
from hotpocket_backend.apps.ui.services import UIImportsService
try:
return UIImportsService().import_from_pocket(
job=job,
account_uuid=account_uuid,
csv_path=csv_path,
)
except Exception as exception:
LOGGER.error('Unhandled exception: %s', exception, exc_info=exception)
raise exception