feat: add deleted_at, created_by_username to Bounty; timezone, admin_user_ids to RoomData

Issue #41: Model updates for Phase 2 features

Bounty model:
- Add deleted_at: int | None - timestamp when deleted (soft-delete)
- Add created_by_username: str | None - username for display purposes

RoomData model:
- Add timezone: str | None - room's timezone (e.g., "Asia/Jakarta")
- Add admin_user_ids: list[int] - list of admin user IDs

Storage adapter updated to handle new fields in load/save operations.
Tests added for new fields.
This commit is contained in:
shokollm
2026-04-04 04:59:58 +00:00
parent 411e19e5d7
commit fee8504813
3 changed files with 63 additions and 0 deletions

View File

@@ -9,6 +9,9 @@ class Bounty:
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.
The deleted_at field indicates soft-delete: None means not deleted,
a value means deleted at that Unix timestamp.
"""
id: int
@@ -17,6 +20,8 @@ class Bounty:
due_date_ts: int | None
created_at: int
created_by_user_id: int
deleted_at: int | None = None
created_by_username: str | None = None
@dataclass
@@ -37,11 +42,20 @@ class RoomData:
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.
The timezone field stores the room's timezone (e.g., "Asia/Jakarta"), default UTC+0.
The admin_user_ids field lists users who have admin privileges in this room.
"""
room_id: int
bounties: list[Bounty]
next_id: int
timezone: str | None = None
admin_user_ids: list[int] | None = None
def __post_init__(self):
if self.admin_user_ids is None:
self.admin_user_ids = []
@dataclass