hotpocket/services/backend/hotpocket_backend/apps/ui/rpc_methods/saves.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

22 lines
611 B
Python

# -*- coding: utf-8 -*-
from __future__ import annotations
from bthlabs_jsonrpc_core import register_method
from django.http import HttpRequest
from hotpocket_backend.apps.core.rpc import wrap_soa_errors
from hotpocket_backend.apps.ui.services.workflows import CreateSaveWorkflow
from hotpocket_soa.dto.associations import AssociationOut
@register_method(method='saves.create')
@wrap_soa_errors
def create(request: HttpRequest, url: str) -> AssociationOut:
association = CreateSaveWorkflow().run_rpc(
request=request,
account=request.user,
url=url,
)
return association