hydraveil-gui/gui/v2/actions/profile_actions.py

26 lines
972 B
Python

from core.services.profiles.update_profile import update_profile
from core.controllers.ProfileController import ProfileController
from gui.v2.infrastructure.take_plumbing_action import take_action
from gui.v2.infrastructure.setup_observers import profile_observer
from core.utils.type_checker import type_checker
from typing import Callable
def create_profile(potential_data: dict, ui_caller: Callable):
"""Pass the data through the plumbing, to the controller to create a profile."""
take_action(
action=ProfileController.create,
ui_caller=ui_caller,
potential_data=potential_data,
profile_observer=profile_observer
)
@type_checker
def edit_profile(profile_id: int, potential_data: dict, ui_caller: Callable):
"""Pass the data through the plumbing, to edit a profile."""
take_action(
action=update_profile,
ui_caller=ui_caller,
profile_id=profile_id,
new_choices=potential_data
)