feat: Category Feature - Models & Storage (#85) #90

Merged
shoko merged 1 commits from feature/category-models-storage into main 2026-04-09 12:35:50 +02:00
Owner

Summary

Add Category dataclass and update storage layer for category support (Issue #85).

Changes

Models (core/models.py)

  • Added Category dataclass with fields: id, name, created_at, deleted_at
  • Added category_ids: list[str] field to Bounty dataclass
  • Added categories: list[Category] field to RoomData dataclass

Storage (adapters/storage/json_file.py)

  • Updated load() to deserialize categories and bounty.category_ids
  • Updated save() to serialize categories and bounty.category_ids

Backward Compatibility

Existing data without categories works fine - new fields have default empty values.

Testing

All 96 existing tests pass.

Closes #85

## Summary Add Category dataclass and update storage layer for category support (Issue #85). ## Changes ### Models (core/models.py) - Added `Category` dataclass with fields: `id`, `name`, `created_at`, `deleted_at` - Added `category_ids: list[str]` field to `Bounty` dataclass - Added `categories: list[Category]` field to `RoomData` dataclass ### Storage (adapters/storage/json_file.py) - Updated `load()` to deserialize categories and bounty.category_ids - Updated `save()` to serialize categories and bounty.category_ids ## Backward Compatibility Existing data without categories works fine - new fields have default empty values. ## Testing All 96 existing tests pass. ## Related Issues Closes #85
shoko added 1 commit 2026-04-09 12:30:27 +02:00
Models & Storage layer for category feature (Issue #85):

- Add Category dataclass to core/models.py
  - id (slug): lowercase alphabetic only
  - name: display name
  - created_at: Unix timestamp
  - deleted_at: soft delete timestamp (None if active)

- Add category_ids field to Bounty dataclass
  - list[str] for multiple categories per bounty
  - Default empty list for backward compatibility

- Add categories field to RoomData dataclass
  - list[Category] for room-level categories
  - Default empty list

- Update JsonFileRoomStorage to serialize/deserialize:
  - Category fields (id, name, created_at, deleted_at)
  - Bounty.category_ids
  - RoomData.categories

Backward compatible: existing data without categories works fine.
han approved these changes 2026-04-09 12:35:23 +02:00
han left a comment
Collaborator

lgtm

lgtm
shoko merged commit 43d07eae92 into main 2026-04-09 12:35:50 +02:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jigaido#90