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:
@@ -28,6 +28,22 @@ class TestBounty:
|
||||
assert b.due_date_ts == 1735689600
|
||||
assert b.created_at == 1735603200
|
||||
assert b.created_by_user_id == 123
|
||||
assert b.deleted_at is None
|
||||
assert b.created_by_username is None
|
||||
|
||||
def test_bounty_with_new_fields(self):
|
||||
b = Bounty(
|
||||
id=1,
|
||||
text="Fix the bug",
|
||||
link="https://github.com/example/repo/issues/1",
|
||||
due_date_ts=1735689600,
|
||||
created_at=1735603200,
|
||||
created_by_user_id=123,
|
||||
deleted_at=1736200000,
|
||||
created_by_username="johndoe",
|
||||
)
|
||||
assert b.deleted_at == 1736200000
|
||||
assert b.created_by_username == "johndoe"
|
||||
|
||||
def test_bounty_optional_fields_can_be_none(self):
|
||||
b = Bounty(
|
||||
@@ -41,6 +57,8 @@ class TestBounty:
|
||||
assert b.text is None
|
||||
assert b.link is None
|
||||
assert b.due_date_ts is None
|
||||
assert b.deleted_at is None
|
||||
assert b.created_by_username is None
|
||||
|
||||
def test_bounty_comparison_equal(self):
|
||||
b1 = Bounty(
|
||||
@@ -103,6 +121,8 @@ class TestRoomData:
|
||||
assert rd.room_id == -1001
|
||||
assert rd.bounties == []
|
||||
assert rd.next_id == 1
|
||||
assert rd.timezone is None
|
||||
assert rd.admin_user_ids == []
|
||||
|
||||
def test_create_dm_room_data(self):
|
||||
rd = RoomData(
|
||||
@@ -113,6 +133,8 @@ class TestRoomData:
|
||||
assert rd.room_id == 123456
|
||||
assert rd.bounties == []
|
||||
assert rd.next_id == 1
|
||||
assert rd.timezone is None
|
||||
assert rd.admin_user_ids == []
|
||||
|
||||
def test_room_data_with_bounties(self):
|
||||
b = Bounty(
|
||||
@@ -128,6 +150,25 @@ class TestRoomData:
|
||||
assert rd.bounties[0].text == "Task"
|
||||
assert rd.bounties[0].created_by_user_id == 123
|
||||
|
||||
def test_room_data_with_new_fields(self):
|
||||
rd = RoomData(
|
||||
room_id=-1001,
|
||||
bounties=[],
|
||||
next_id=1,
|
||||
timezone="Asia/Jakarta",
|
||||
admin_user_ids=[123, 456],
|
||||
)
|
||||
assert rd.timezone == "Asia/Jakarta"
|
||||
assert rd.admin_user_ids == [123, 456]
|
||||
|
||||
def test_room_data_admin_user_ids_defaults_to_empty_list(self):
|
||||
rd = RoomData(
|
||||
room_id=-1001,
|
||||
bounties=[],
|
||||
next_id=1,
|
||||
)
|
||||
assert rd.admin_user_ids == []
|
||||
|
||||
|
||||
class TestTrackingData:
|
||||
def test_create_tracking_data(self):
|
||||
|
||||
Reference in New Issue
Block a user