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

Merged
shoko merged 2 commits from fix/issue-9 into main 2026-04-03 14:24:06 +02:00
Owner

Summary

Implements the JSON file storage adapter for issue #9.

Implements RoomStorage and TrackingStorage ports using JSON file persistence:

  • JsonFileRoomStorage: Stores room data at ~/.jigaido/data/<room_id>.json
  • JsonFileTrackingStorage: Stores tracking data at ~/.jigaido/tracking/<room_id>_<user_id>.json

Features

  • Atomic writes using tempfile + rename for data safety
  • Automatic directory creation
  • Implements all methods from ports.py protocols

Closes #9

## Summary Implements the JSON file storage adapter for issue #9. Implements RoomStorage and TrackingStorage ports using JSON file persistence: - **JsonFileRoomStorage**: Stores room data at ~/.jigaido/data/<room_id>.json - **JsonFileTrackingStorage**: Stores tracking data at ~/.jigaido/tracking/<room_id>_<user_id>.json ## Features - Atomic writes using tempfile + rename for data safety - Automatic directory creation - Implements all methods from ports.py protocols Closes #9
shoko added 1 commit 2026-04-03 11:37:18 +02:00
Implements RoomStorage and TrackingStorage ports using JSON file persistence:
- JsonFileRoomStorage: Stores room data at ~/.jigaido/data/<room_id>.json
- JsonFileTrackingStorage: Stores tracking data at ~/.jigaido/tracking/<room_id>_<user_id>.json

Features:
- Atomic writes using tempfile + rename for data safety
- Automatic directory creation
- Implements all methods from ports.py protocols
han requested changes 2026-04-03 13:22:40 +02:00
Dismissed
han left a comment
Collaborator

lets add unit tests as well. I'd like to see if its possible to track the same bounty multiple times. if possible, should we handle the logic here or somewhere else?

lets add unit tests as well. I'd like to see if its possible to track the same bounty multiple times. if possible, should we handle the logic here or somewhere else?
@@ -0,0 +3,4 @@
Implements RoomStorage and TrackingStorage ports using JSON file persistence.
Data stored at:
- Rooms: ~/.jigaido/data/<room_id>.json
- Tracking: ~/.jigaido/tracking/<room_id>_<user_id>.json
Collaborator

can we store both of the data under data folder instead of separating them?

basically

rooms: ~/.jigaido/data/room/<room_id>.json
tracking: ~/.jigaido/data/tracking/<room_id>_<user_id>.json

this way we have both under rooms, and its easier to migrate as well

can we store both of the data under data folder instead of separating them? basically rooms: ~/.jigaido/data/room/<room_id>.json tracking: ~/.jigaido/data/tracking/<room_id>_<user_id>.json this way we have both under rooms, and its easier to migrate as well
han marked this conversation as resolved
shoko added 1 commit 2026-04-03 13:38:47 +02:00
- Add tests/test_json_file.py with unit tests for JsonFileRoomStorage and JsonFileTrackingStorage
- Reorganize data directories per han's feedback:
  - Rooms: ~/.jigaido/data/room/<room_id>.json (was ~/.jigaido/data/<room_id>.json)
  - Tracking: ~/.jigaido/data/tracking/<room_id>_<user_id>.json (was ~/.jigaido/tracking/...)
- Note: duplicate tracking is handled at TrackingService layer (returns False if already tracking), adapter allows duplicates by design
han approved these changes 2026-04-03 13:53:49 +02:00
han left a comment
Collaborator

lgtm

lgtm
shoko merged commit edbc924b98 into main 2026-04-03 14:24:06 +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#27