-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Francia Csaba
committed
Aug 1, 2024
1 parent
7db9706
commit 6b42501
Showing
3 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from typing import List | ||
from amarillo.models.Carpool import Carpool | ||
|
||
class CarpoolEvents: | ||
def on_create(cp : Carpool): | ||
pass | ||
def on_update(cp : Carpool): | ||
pass | ||
def on_delete(cp : Carpool): | ||
pass | ||
|
||
carpool_event_listeners : List[CarpoolEvents] = [] | ||
|
||
def register_carpool_event_listener(cpe : CarpoolEvents): | ||
carpool_event_listeners.append(cpe) | ||
|
||
def run_on_create(cp: Carpool): | ||
for cpe in carpool_event_listeners: | ||
cpe.on_create(cp) | ||
|
||
def run_on_update(cp: Carpool): | ||
for cpe in carpool_event_listeners: | ||
cpe.on_update(cp) | ||
|
||
def run_on_delete(cp: Carpool): | ||
for cpe in carpool_event_listeners: | ||
cpe.on_delete(cp) |