-
-
Save msf/59237884459badf73b7d089f4fcb88a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from services.app.create import create_app | |
from services.update import update_app | |
from services.delete import delete_app | |
from repositories.app import delete_app, find_app_by_id, idempotent_save_app | |
class AppHandler(object): | |
def create(self, name: str, description: str) -> Entity: | |
if not validate_create_input(name, description): | |
... | |
app = create_app(name, description) | |
self.metrics.record_metric(...) | |
self.event_publisher("create_entity"..) | |
return entity | |
def update(self, app_id, name, description): | |
if not validate_update_input(app_id, name, description): | |
... | |
old_app = find_app_by_id(app_id) | |
app = update_app(old_app, name, description) | |
self.metrics.record_metric(...) | |
self.event_publisher("...") | |
return app | |
def delete(self, app_id): | |
if not validate_delete_input(app_id): | |
... | |
app = find_app_by_id(app_id) | |
delete_app(app): | |
self.metrics.record_metric(...) | |
self.event_publisher("...") | |
return | |
def __init__(...): | |
self.metrics = ... | |
self.event_publisher = ... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment