Commit Graph

12 Commits

Author SHA1 Message Date
shokollm
9b8b15414f feat(config): implement configuration management for issue #7
- Create config.py with Config class
- Config precedence: ENV > config file > defaults
- data_dir: JIGAIDO_DATA_DIR env or ~/.jigaido/config.json or default
- bot_token: JIGAIDO_BOT_TOKEN env var
- ensure_data_dir() method to create data directory
- Add tests/test_config.py with 7 passing tests

Fixes #7
2026-04-02 20:16:41 +00:00
98a8c4d173 Merge pull request 'feat: Replace SQLite with per-user JSON storage (fixes #2)' (#3) from fix/issue-2-json-storage into main 2026-04-02 17:44:08 +02:00
shokollm
7c2bd09ada feat: implement new storage design per issue #2
- Storage: Change from per-user to per-group JSON files
- Data location: ~/.jigaido/ instead of apps/telegram-bot/data/
- Group bounties: data/{group_id}/group.json
- User tracking: data/{group_id}/{user_id}.json
- Personal bounties: data/{user_id}/user.json
- Update commands.py for new storage model
- Update bot.py to remove admin handlers
- Update tests to reflect created_by_user_id field
- Update SPEC.md with new design

Addresses user feedback from issue #2
2026-04-02 14:56:42 +00:00
shokollm
332d7fc60a Update issue #2 storage design with new file structure 2026-04-01 21:31:51 +00:00
shokollm
2e7b20ed81 Update issue #2 storage design with new file structure
Changed from per-user flat files to group/DM directory structure:
- data/{group_id}/group.json — group bounties
- data/{group_id}/{user_id}.json — user tracking in group
- data/{user_id}/user.json — user personal bounties (DM)
- Groups isolated, no cross-group access
- Tracking is per-group-per-user
2026-04-01 21:31:34 +00:00
shokollm
8bb964fdd0 feat: Replace SQLite with per-user JSON storage (fixes #2)
- Add storage.py with load_user(), save_user(), next_bounty_id()
- Rewrite commands.py to use JSON storage (simplified)
- Remove db.py, schema.sql, cron.py, test_db.py
- Update SPEC.md to reflect new architecture
- Admin model removed (anyone can add, creator only can edit/delete)
- No reminders in v1
2026-04-01 10:02:51 +00:00
shokollm
8647f2f4b8 Add issue template for v2 storage simplification 2026-04-01 09:53:38 +00:00
shokollm
d6f98c9163 Fix db.py connection handling and test isolation
db.py:
- Add conn.isolation_level = None to get_conn() — fixes row_factory +
  autocommit conflict. row_factory disables implicit transactions,
  so we need explicit autocommit mode.
- Remove all conn.commit() calls (unnecessary with autocommit)

pyproject.toml:
- Move pytest + pytest-asyncio to main dependencies (uv run pytest
  uses ephemeral env with main deps only)

tests/test_db.py:
- Fix test_upsert_user_updates_username to not chain upsert_user()
  calls in assert expressions (test isolation issue)
2026-04-01 09:35:17 +00:00
shokollm
965c84379b Add uv support, systemd service, and deployment tooling
- pyproject.toml: uv-native project definition (replaces requirements.txt for uv users)
- requirements.txt: kept for pip compatibility
- deploy/jigaido-bot.service: systemd service file (copy to /etc/systemd/system/)
- deploy/setup.sh: automated deployment script
- README.md: updated with uv instructions, tmux, and systemd setup
2026-04-01 09:15:41 +00:00
shokollm
7957947a04 Add tests + fix db.py SQLite commit pattern
Tests:
- tests/test_commands.py: parse_args, extract_args, format_bounty
- tests/test_db.py: full CRUD + tracking + reminders
- tests/conftest.py: temp DB fixture
- requirements-dev.txt: pytest + pytest-asyncio

db.py fixes:
- Explicit conn.commit() after every write (SQLite row_factory
  disables implicit transaction management)
- fetchone() before commit() (can't commit while cursor open)
- Functions return dict instead of sqlite3.Row
2026-04-01 08:41:44 +00:00
shokollm
9f0ad2d404 Refactor to apps/ structure
JIGAIDO is now a platform with apps/ as the container.
All telegram-bot files moved to apps/telegram-bot/:
- bot.py, commands.py, cron.py, db.py, schema.sql
- requirements.txt, .env.example, README.md
- Root now holds SPEC.md, README.md, CONTRIBUTING.md only.

Structure:
jigaido/
├── apps/
│   └── telegram-bot/
└── SPEC.md, README.md, CONTRIBUTING.md
2026-04-01 08:05:10 +00:00
shokollm
be5fe04a90 Initial commit: project scaffold, full spec, database schema, bot and cron
- SPEC.md: full project specification from design discussion
- schema.sql: SQLite database schema
- db.py: database wrapper with all query functions
- bot.py: telegram bot entrypoint
- commands.py: all command handlers with admin/creator guards
- cron.py: daily reminder job
- requirements.txt: python-telegram-bot, dateparser
- README.md, CONTRIBUTING.md
- .gitignore
2026-04-01 07:38:18 +00:00