- TrackingData.group_id renamed to room_id (works for both group and DM) - Removed room_id from TrackedBounty (it's just a lightweight pointer)
62 lines
1.5 KiB
Python
62 lines
1.5 KiB
Python
"""Domain dataclasses for JIGAIDO bounty tracker."""
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class Bounty:
|
|
"""A bounty created by a user.
|
|
|
|
The created_by_user_id field always refers to the user who created the bounty.
|
|
It does NOT indicate whether the bounty is a group or personal bounty.
|
|
"""
|
|
|
|
id: int
|
|
text: str | None
|
|
link: str | None
|
|
due_date_ts: int | None
|
|
created_at: int
|
|
created_by_user_id: int
|
|
|
|
|
|
@dataclass
|
|
class TrackedBounty:
|
|
"""A bounty that a user is tracking.
|
|
|
|
Lightweight relation/pointer - the actual tracking context (including room)
|
|
lives in TrackingData, not here.
|
|
"""
|
|
|
|
bounty_id: int
|
|
created_at: int
|
|
|
|
|
|
@dataclass
|
|
class RoomData:
|
|
"""All data for a room (group or DM).
|
|
|
|
The room_id can be negative for Telegram groups or positive for DMs.
|
|
The next_id field is used to generate unique bounty IDs within this room.
|
|
"""
|
|
|
|
room_id: int
|
|
bounties: list[Bounty]
|
|
next_id: int
|
|
|
|
|
|
@dataclass
|
|
class TrackingData:
|
|
"""User tracking state within a room (group or DM).
|
|
|
|
TrackingData vs TrackedBounty:
|
|
- Use TrackingData to store ALL tracked bounties for a user in a specific room.
|
|
It contains the room_id, user_id, and a list of TrackedBounty entries.
|
|
- Use TrackedBounty to represent a single tracked bounty entry within that list.
|
|
|
|
TrackingData is the container, TrackedBounty is the item.
|
|
"""
|
|
|
|
room_id: int
|
|
user_id: int
|
|
tracked: list[TrackedBounty]
|