feat(adapter): implement JSON file storage adapter for issue #9 #22

Closed
shoko wants to merge 0 commits from feat/issue-9-json-storage into main
Owner

Summary

Implement JSON file storage adapter that implements RoomStorage and TrackingStorage ports.

Changes

  • Add adapters/__init__.py and adapters/storage/__init__.py
  • Add adapters/storage/json_file.py with:
    • JsonFileRoomStorage - stores room data at ~/.jigaido/data/<room_id>.json
    • JsonFileTrackingStorage - stores tracking data at ~/.jigaido/tracking/<room_id>_<user_id>.json
  • Add comprehensive tests in tests/test_json_file_adapter.py

Implementation

Both adapters implement the protocols defined in core/ports.py:

  • RoomStorage: load, save, add_bounty, update_bounty, delete_bounty, get_bounty
  • TrackingStorage: load, save, track_bounty, untrack_bounty

Testing

All 18 tests pass:

  • Protocol implementation verification
  • CRUD operations for rooms and bounties
  • CRUD operations for tracking
  • Persistence across storage instances

Fixes #9

## Summary Implement JSON file storage adapter that implements RoomStorage and TrackingStorage ports. ## Changes - Add `adapters/__init__.py` and `adapters/storage/__init__.py` - Add `adapters/storage/json_file.py` with: - `JsonFileRoomStorage` - stores room data at `~/.jigaido/data/<room_id>.json` - `JsonFileTrackingStorage` - stores tracking data at `~/.jigaido/tracking/<room_id>_<user_id>.json` - Add comprehensive tests in `tests/test_json_file_adapter.py` ## Implementation Both adapters implement the protocols defined in `core/ports.py`: - `RoomStorage`: load, save, add_bounty, update_bounty, delete_bounty, get_bounty - `TrackingStorage`: load, save, track_bounty, untrack_bounty ## Testing All 18 tests pass: - Protocol implementation verification - CRUD operations for rooms and bounties - CRUD operations for tracking - Persistence across storage instances Fixes #9
shoko added 1 commit 2026-04-03 10:08:37 +02:00
Add JsonFileRoomStorage and JsonFileTrackingStorage implementations
that implement the RoomStorage and TrackingStorage ports.

- Stores room data at ~/.jigaido/data/<room_id>.json
- Stores tracking data at ~/.jigaido/tracking/<room_id>_<user_id>.json
- Implements all port methods: load, save, add_bounty, update_bounty,
  delete_bounty, get_bounty for rooms; load, save, track_bounty,
  untrack_bounty for tracking

Fixes #9
shoko closed this pull request 2026-04-03 10:21:34 +02:00

Pull request closed

Sign in to join this conversation.