This commit is contained in:
2025-12-05 17:40:57 -05:00
parent 6423d1c1a2
commit fa9fabcd9f
43 changed files with 1506 additions and 529 deletions

View File

@@ -1,18 +0,0 @@
from events.types.payload import Payload
class ChildAdd(Payload):
def __init__(self, child_id: str, status: str):
super().__init__({
'child_id': child_id,
'status': status,
})
@property
def child_id(self) -> str:
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -1,18 +0,0 @@
from events.types.payload import Payload
class ChildDelete(Payload):
def __init__(self, child_id: str, status: str):
super().__init__({
'child_id': child_id,
'status': status,
})
@property
def child_id(self) -> str:
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -0,0 +1,21 @@
from events.types.payload import Payload
class ChildModified(Payload):
OPERATION_ADD = "ADD"
OPERATION_EDIT = "EDIT"
OPERATION_DELETE = "DELETE"
def __init__(self, child_id: str, operation: str):
super().__init__({
'child_id': child_id,
'operation': operation,
})
@property
def child_id(self) -> str:
return self.get("child_id")
@property
def operation(self) -> str:
return self.get("operation")

View File

@@ -0,0 +1,27 @@
from events.types.payload import Payload
class ChildRewardRequest(Payload):
REQUEST_GRANTED = "GRANTED"
REQUEST_CREATED = "CREATED"
REQUEST_CANCELLED = "CANCELLED"
def __init__(self, child_id, reward_id: str, operation: str):
super().__init__({
'child_id': child_id,
'reward_id': reward_id,
'operation': operation
})
@property
def child_id(self) -> str:
return self.get("child_id")
@property
def reward_id(self) -> str:
return self.get("reward_id")
@property
def operation(self) -> str:
return self.get("operation")

View File

@@ -1,12 +1,11 @@
from events.types.payload import Payload
class RewardUpdate(Payload):
def __init__(self, reward_id: str, child_id: str, status: str, points: int):
class ChildRewardTriggered(Payload):
def __init__(self, reward_id: str, child_id: str, points: int):
super().__init__({
'reward_id': reward_id,
'child_id': child_id,
'status': status,
'points': points
})
@@ -18,10 +17,6 @@ class RewardUpdate(Payload):
def child_id(self) -> str:
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")
@property
def points(self) -> int:
return self.get("points", 0)

View File

@@ -1,11 +1,11 @@
from events.types.payload import Payload
class RewardSet(Payload):
def __init__(self, child_id: str, status: str):
class ChildRewardsSet(Payload):
def __init__(self, child_id: str, reward_ids: list[str]):
super().__init__({
'child_id': child_id,
'status': status
'reward_ids': reward_ids
})
@property
@@ -13,7 +13,8 @@ class RewardSet(Payload):
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")
def reward_ids(self) -> list[str]:
return self.get("reward_ids", [])

View File

@@ -1,12 +1,11 @@
from events.types.payload import Payload
class TaskUpdate(Payload):
def __init__(self, task_id: str, child_id: str, status: str, points: int):
class ChildTaskTriggered(Payload):
def __init__(self, task_id: str, child_id: str, points: int):
super().__init__({
'task_id': task_id,
'child_id': child_id,
'status': status,
'points': points
})
@@ -18,10 +17,6 @@ class TaskUpdate(Payload):
def child_id(self) -> str:
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")
@property
def points(self) -> int:
return self.get("points", 0)

View File

@@ -1,11 +1,11 @@
from events.types.payload import Payload
class TaskSet(Payload):
def __init__(self, child_id: str, status: str):
class ChildTasksSet(Payload):
def __init__(self, child_id: str, task_ids: list[str]):
super().__init__({
'child_id': child_id,
'status': status
'task_ids': task_ids
})
@property
@@ -13,7 +13,7 @@ class TaskSet(Payload):
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")
def task_ids(self) -> list[str]:
return self.get("task_ids", [])

View File

@@ -1,18 +0,0 @@
from events.types.payload import Payload
class ChildUpdate(Payload):
def __init__(self, child_id: str, status: str):
super().__init__({
'child_id': child_id,
'status': status,
})
@property
def child_id(self) -> str:
return self.get("child_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -2,18 +2,14 @@ from enum import Enum
class EventType(Enum):
TASK_UPDATE = "task_update"
TASK_SET = "task_set"
TASK_TEST = "task_test"
REWARD_UPDATE = "reward_update"
REWARD_SET = "reward_set"
CHILD_UPDATE = "child_update"
CHILD_ADD = "child_add"
CHILD_DELETE = "child_delete"
TASK_CREATED = "task_created"
TASK_DELETED = "task_deleted"
TASK_EDITED = "task_edited"
REWARD_CREATED = "reward_created"
REWARD_DELETED = "reward_deleted"
REWARD_EDITED = "reward_edited"
# Add more event types here
CHILD_TASK_TRIGGERED = "child_task_triggered"
CHILD_TASKS_SET = "child_tasks_set"
TASK_MODIFIED = "task_modified"
REWARD_MODIFIED = "reward_modified"
CHILD_REWARD_TRIGGERED = "child_reward_triggered"
CHILD_REWARDS_SET = "child_rewards_set"
CHILD_REWARD_REQUEST = "child_reward_request"
CHILD_MODIFIED = "child_modified"

View File

@@ -1,19 +0,0 @@
from events.types.payload import Payload
class RewardCreated(Payload):
def __init__(self, reward_id: str, status: str):
super().__init__({
'reward_id': reward_id,
'status': status
})
@property
def reward_id(self) -> str:
return self.get("reward_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -1,19 +0,0 @@
from events.types.payload import Payload
class RewardDeleted(Payload):
def __init__(self, reward_id: str, status: str):
super().__init__({
'reward_id': reward_id,
'status': status
})
@property
def reward_id(self) -> str:
return self.get("reward_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -1,19 +0,0 @@
from events.types.payload import Payload
class RewardEdited(Payload):
def __init__(self, reward_id: str, status: str):
super().__init__({
'reward_id': reward_id,
'status': status
})
@property
def reward_id(self) -> str:
return self.get("reward_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -0,0 +1,22 @@
from events.types.payload import Payload
class RewardModified(Payload):
OPERATION_ADD = "ADD"
OPERATION_EDIT = "EDIT"
OPERATION_DELETE = "DELETE"
def __init__(self, reward_id: str, operation: str):
super().__init__({
'reward_id': reward_id,
'operation': operation
})
@property
def reward_id(self) -> str:
return self.get("reward_id")
@property
def operation(self) -> str:
return self.get("operation")

View File

@@ -1,19 +0,0 @@
from events.types.payload import Payload
class TaskCreated(Payload):
def __init__(self, task_id: str, status: str):
super().__init__({
'task_id': task_id,
'status': status
})
@property
def task_id(self) -> str:
return self.get("task_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -1,19 +0,0 @@
from events.types.payload import Payload
class TaskDeleted(Payload):
def __init__(self, task_id: str, status: str):
super().__init__({
'task_id': task_id,
'status': status
})
@property
def task_id(self) -> str:
return self.get("task_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -1,19 +0,0 @@
from events.types.payload import Payload
class TaskEdited(Payload):
def __init__(self, task_id: str, status: str):
super().__init__({
'task_id': task_id,
'status': status
})
@property
def task_id(self) -> str:
return self.get("task_id")
@property
def status(self) -> str:
return self.get("status")

View File

@@ -0,0 +1,22 @@
from events.types.payload import Payload
class TaskModified(Payload):
OPERATION_ADD = "ADD"
OPERATION_EDIT = "EDIT"
OPERATION_DELETE = "DELETE"
def __init__(self, task_id: str, operation: str):
super().__init__({
'task_id': task_id,
'operation': operation
})
@property
def task_id(self) -> str:
return self.get("task_id")
@property
def operation(self) -> str:
return self.get("operation")

View File

@@ -1,17 +0,0 @@
from events.types.payload import Payload
class TaskTest(Payload):
def __init__(self, task_id: str, message: str):
super().__init__({
'task_id': task_id,
'message': message
})
@property
def task_id(self) -> str:
return self.get("task_id")
@property
def message(self) -> str:
return self.get("message")