[Phase 1] Task 1: Create core/models.py — Domain dataclasses #5

Closed
opened 2026-04-02 18:28:39 +02:00 by shoko · 0 comments
Owner

Task 1: Create core/models.py

Labels: phase-1, core
Dependency: None — can start immediately

Goal

Define all domain dataclasses for the JIGAIDO bounty tracker.

Files to create

  • core/__init__.py
  • core/models.py

Domain dataclasses to implement

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

Acceptance Criteria

  • All dataclasses defined with proper types
  • Optional fields properly typed with Optional[T]
  • Can be instantiated and compared
  • Unit tests in tests/test_models.py pass
## Task 1: Create core/models.py **Labels:** phase-1, core **Dependency:** None — can start immediately ### Goal Define all domain dataclasses for the JIGAIDO bounty tracker. ### Files to create - `core/__init__.py` - `core/models.py` ### Domain dataclasses to implement ```python 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 ``` ### Acceptance Criteria - [ ] All dataclasses defined with proper types - [ ] Optional fields properly typed with `Optional[T]` - [ ] Can be instantiated and compared - [ ] Unit tests in `tests/test_models.py` pass
shoko added the phase-1core labels 2026-04-02 18:34:19 +02:00
shoko closed this issue 2026-04-03 00:37:30 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jigaido#5