All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 3m0s
- Add backend routines management with add, get, update, delete, and list functionalities. - Create models for Routine, RoutineItem, RoutineSchedule, and RoutineExtension. - Develop event types for routine confirmation and modification. - Implement frontend components for routine assignment, confirmation dialog, and routine management views. - Add unit tests for routine API and integration tests for routine CRUD flow. - Create end-to-end test plan for routines feature covering parent and child interactions.
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
from dataclasses import dataclass, field
|
|
from models.base import BaseModel
|
|
|
|
@dataclass
|
|
class Child(BaseModel):
|
|
name: str
|
|
age: int | None = None
|
|
tasks: list[str] = field(default_factory=list)
|
|
routines: list[str] = field(default_factory=list)
|
|
rewards: list[str] = field(default_factory=list)
|
|
points: int = 0
|
|
image_id: str | None = None
|
|
user_id: str | None = None
|
|
|
|
@classmethod
|
|
def from_dict(cls, d: dict):
|
|
return cls(
|
|
name=d.get('name'),
|
|
age=d.get('age'),
|
|
tasks=d.get('tasks', []),
|
|
routines=d.get('routines', []),
|
|
rewards=d.get('rewards', []),
|
|
points=d.get('points', 0),
|
|
image_id=d.get('image_id'),
|
|
user_id=d.get('user_id'),
|
|
id=d.get('id'),
|
|
created_at=d.get('created_at'),
|
|
updated_at=d.get('updated_at')
|
|
)
|
|
|
|
def to_dict(self):
|
|
base = super().to_dict()
|
|
base.update({
|
|
'name': self.name,
|
|
'age': self.age,
|
|
'tasks': self.tasks,
|
|
'routines': self.routines,
|
|
'rewards': self.rewards,
|
|
'points': self.points,
|
|
'image_id': self.image_id,
|
|
'user_id': self.user_id
|
|
})
|
|
return base
|