feat(core): implement domain dataclasses for issue #5
- Create core/__init__.py - Create core/models.py with all domain dataclasses: - Bounty (base class) - GroupBounty (extends Bounty) - PersonalBounty (extends Bounty) - TrackedBounty - GroupData - TrackingData - UserData - Create tests/test_models.py with 15 passing tests Fixes #5
This commit is contained in:
21
core/__init__.py
Normal file
21
core/__init__.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Core domain models for JIGAIDO."""
|
||||
|
||||
from core.models import (
|
||||
Bounty,
|
||||
GroupBounty,
|
||||
PersonalBounty,
|
||||
TrackedBounty,
|
||||
GroupData,
|
||||
TrackingData,
|
||||
UserData,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Bounty",
|
||||
"GroupBounty",
|
||||
"PersonalBounty",
|
||||
"TrackedBounty",
|
||||
"GroupData",
|
||||
"TrackingData",
|
||||
"UserData",
|
||||
]
|
||||
63
core/models.py
Normal file
63
core/models.py
Normal file
@@ -0,0 +1,63 @@
|
||||
"""Domain dataclasses for JIGAIDO bounty tracker."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class Bounty:
|
||||
"""Base bounty with common fields."""
|
||||
|
||||
id: int
|
||||
text: Optional[str]
|
||||
link: Optional[str]
|
||||
due_date_ts: Optional[int]
|
||||
created_at: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class GroupBounty(Bounty):
|
||||
"""Bounty created in a group context."""
|
||||
|
||||
created_by_user_id: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class PersonalBounty(Bounty):
|
||||
"""Bounty created in DM/personal context."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
@dataclass
|
||||
class TrackedBounty:
|
||||
"""A bounty that a user is tracking."""
|
||||
|
||||
bounty_id: int
|
||||
created_at: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class GroupData:
|
||||
"""All data for a group."""
|
||||
|
||||
group_id: int
|
||||
bounties: list[GroupBounty]
|
||||
next_id: int
|
||||
|
||||
|
||||
@dataclass
|
||||
class TrackingData:
|
||||
"""User tracking data within a group."""
|
||||
|
||||
user_id: int
|
||||
tracked: list[TrackedBounty]
|
||||
|
||||
|
||||
@dataclass
|
||||
class UserData:
|
||||
"""All personal bounties for a user (DM mode)."""
|
||||
|
||||
user_id: int
|
||||
bounties: list[PersonalBounty]
|
||||
next_id: int
|
||||
Reference in New Issue
Block a user