- 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
64 lines
1.0 KiB
Python
64 lines
1.0 KiB
Python
"""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
|