You've already forked hotpocket
BTHLABS-66: Prepping for public release: Take five
AKA "Using Apple reviewers as QA for your project". Thanks, y'all! :)
This commit is contained in:
@@ -3,19 +3,28 @@ from __future__ import annotations
|
||||
|
||||
from bthlabs_jsonrpc_core import register_method
|
||||
from django.http import HttpRequest
|
||||
from django.urls import reverse
|
||||
|
||||
from hotpocket_backend.apps.core.rpc import wrap_soa_errors
|
||||
from hotpocket_backend.apps.ui.dto.rpc import SavesCreateOut
|
||||
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:
|
||||
def create(request: HttpRequest, url: str) -> SavesCreateOut:
|
||||
association = CreateSaveWorkflow().run_rpc(
|
||||
request=request,
|
||||
account=request.user,
|
||||
url=url,
|
||||
)
|
||||
|
||||
return association
|
||||
result = SavesCreateOut.model_validate({
|
||||
'id': association.pk,
|
||||
'target_uuid': association.target_uuid,
|
||||
'url': request.build_absolute_uri(reverse(
|
||||
'ui.associations.view', args=(association.pk,),
|
||||
)),
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user