Service layer: admin management, timezone, soft delete/recover #43

Closed
opened 2026-04-04 06:44:58 +02:00 by shoko · 0 comments
Owner

Objective

Add service layer methods for Phase 2 features.

Changes Required

BountyService

  • Add is_admin(room_id, user_id) -> bool - check if user is admin
  • Add add_admin(room_id, user_id) -> None - add admin
  • Add remove_admin(room_id, user_id) -> None - remove admin
  • Add list_admins(room_id) -> list[int] - list admin IDs
  • Add set_timezone(room_id, timezone) -> None - set room timezone
  • Add get_timezone(room_id) -> str - get room timezone (default UTC+0)
  • Add list_deleted_bounties(room_id) -> list[Bounty] - for /recover list
  • Modify list_bounties() to exclude soft-deleted
  • Modify update_bounty() to check admin permission (not creator)
  • Modify delete_bounty() to perform soft delete (set deleted_at)
  • Modify add_bounty() to check link uniqueness within room
  • Add check_link_unique(room_id, link, exclude_bounty_id=None) -> bool

TrackingService

  • No major changes needed

Permissions

  • /add, /edit, /delete: admin only (not creator-only as before)
  • /admin, /admin add, /admin remove: admin only
  • /bounty, /show, /track, /untrack, /my: everyone

Dependencies

  • #42 (storage must be done first)
## Objective Add service layer methods for Phase 2 features. ## Changes Required ### BountyService - Add `is_admin(room_id, user_id) -> bool` - check if user is admin - Add `add_admin(room_id, user_id) -> None` - add admin - Add `remove_admin(room_id, user_id) -> None` - remove admin - Add `list_admins(room_id) -> list[int]` - list admin IDs - Add `set_timezone(room_id, timezone) -> None` - set room timezone - Add `get_timezone(room_id) -> str` - get room timezone (default UTC+0) - Add `list_deleted_bounties(room_id) -> list[Bounty]` - for /recover list - Modify `list_bounties()` to exclude soft-deleted - Modify `update_bounty()` to check admin permission (not creator) - Modify `delete_bounty()` to perform soft delete (set deleted_at) - Modify `add_bounty()` to check link uniqueness within room - Add `check_link_unique(room_id, link, exclude_bounty_id=None) -> bool` ### TrackingService - No major changes needed ## Permissions - /add, /edit, /delete: admin only (not creator-only as before) - /admin, /admin add, /admin remove: admin only - /bounty, /show, /track, /untrack, /my: everyone ## Dependencies - #42 (storage must be done first)
shoko added this to the Phase 2 milestone 2026-04-04 06:44:58 +02:00
shoko added the corephase-2 labels 2026-04-04 06:44:58 +02:00
han was assigned by shoko 2026-04-04 06:44:58 +02:00
shoko closed this issue 2026-04-04 07:36:10 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jigaido#43