Commit Graph

7 Commits

Author SHA1 Message Date
panw
f425a49773 feat: implement all 4 ORM models (SshKey, Server, Repo, SyncLog)
- Created SshKey model with encrypted private key storage
- Created Server model with Gitea configuration and SshKey relationship
- Created Repo model with repository mirror info and Server relationship
- Created SyncLog model with sync operation logs and Repo relationship
- Updated models/__init__.py to export all models
- All models use Integer (Unix timestamp) for datetime fields
- Proper bidirectional relationships using back_populates
- Added comprehensive test suite for all models and relationships

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 15:37:36 +08:00
panw
a1efa8a906 feat: add database module
- Add SQLAlchemy database module with DeclarativeBase
- Implement engine and session factory management
- Add context manager for database sessions
- Add database initialization script
- Update models/__init__.py to import Base from database
- Fix Python 3.8 compatibility issues (use Optional instead of |)
- Ensure SQLite database file is created on init_db

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 15:26:31 +08:00
panw
8852fdf708 feat: add security module (encryption + auth)
- Implement AES-256-GCM encryption for sensitive data
- Implement decryption function
- Implement Bearer token authentication verification
- Add comprehensive tests for encryption/decryption roundtrip
- Add tests for API token verification (success and failure cases)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 15:18:14 +08:00
panw
b1060314a2 fix: improve config module with lazy init and validation
Fixes from code review:

Critical:
- Replace module-level `settings = Settings()` with lazy initialization
  via `get_settings()` function to avoid import failures when env vars
  not set

Important:
- Remove unused `import os` from test_config.py
- Add tests for computed properties (db_path, ssh_keys_dir, repos_dir)
- Add field validation for encrypt_key:
  * Validates base64 format
  * Ensures decoded key is at least 32 bytes for AES-256
- Fix Python 3.8 compatibility (use Optional[Settings] instead of | union)

All tests pass (6/6).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 15:13:10 +08:00
panw
cd6bf9bb13 feat: add configuration management
- Add Settings class using pydantic-settings
- Load config from environment variables with GM_ prefix
- Support encrypt_key and api_token (required, no defaults for security)
- Provide defaults for data_dir, host, port
- Add computed properties for db_path, ssh_keys_dir, repos_dir
- Add tests for config defaults and environment variable overrides
- Add Base class to app.models to unblock conftest.py imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 15:07:55 +08:00
panw
afe385d48b fix: improve conftest.py with comments and remove unused imports
- Remove unused imports (os, tempfile)
- Add comment explaining app.models import will fail until Task 2.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 15:01:15 +08:00
panw
f720de6b58 feat: initialize project structure and configuration
- Create backend directory structure (app/models, app/schemas, app/services, app/api, app/tasks, tests)
- Create frontend directory structure (src/router, src/views, src/components, src/api, src/stores)
- Create data directories (ssh_keys, repos)
- Add requirements.txt with FastAPI, SQLAlchemy, Pydantic, and testing dependencies
- Add frontend package.json with Vue 3, Vue Router, Pinia, and Element Plus
- Add .env.example with configuration template
- Add .gitignore for Python, data directories, and frontend
- Add pytest conftest.py with test fixtures for database and environment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 14:57:51 +08:00