Have claude update the plan.

This commit is contained in:
Drew 2025-09-22 00:41:36 -07:00
parent 8dae570755
commit 085f3d9787
6 changed files with 1426 additions and 58 deletions

View file

@ -29,6 +29,26 @@ Captain's Log is a GTD-inspired personal task management system designed to mini
- **Dev Database**: SQLite for easy setup and portability
- **Production Database**: PostgreSQL for scalability
- **Authentication**: Simple session-based auth (single user)
- **Architecture**: Active Record pattern with models handling persistence
- **Testing**: Unit tests + Hurl API integration tests
#### Backend Project Structure
```
backend/
├── src/
│ ├── main.rs # Application entry point with health endpoint
│ ├── database/
│ │ ├── mod.rs # Database module exports
│ │ └── connection.rs # Database connection utilities
│ ├── models/
│ │ ├── mod.rs # Models module
│ │ └── task.rs # TaskModel with CRUD methods
│ └── services/
│ ├── mod.rs # Error handling and exports
│ └── tasks.rs # HTTP handlers for task endpoints
├── tests/api/ # Hurl API integration tests
└── migrations/ # SQLx database migrations
```
### Frontend: Vite + React + Tailwind CSS
- **Build Tool**: Vite for fast development and optimized builds
@ -41,10 +61,11 @@ Captain's Log is a GTD-inspired personal task management system designed to mini
### Core Data Models
```sql
-- Tasks (Phase 1 MVP)
tasks (id, title, description, priority, due_date, status, created_at, updated_at, completed_at)
-- Tasks (Phase 1 MVP - Current Implementation)
tasks (id, title, description, status, created_at, updated_at, completed_at)
-- Future phases will add:
-- priority and due_date fields to tasks table
-- projects (id, name, description, color, status, created_at, updated_at)
-- contexts (id, name, description, color, icon)
-- task_contexts (task_id, context_id)
@ -56,10 +77,15 @@ tasks (id, title, description, priority, due_date, status, created_at, updated_a
### Testing
```bash
# Backend tests
cargo test
cargo tarpaulin --out Html # Coverage report
just test-unit # Unit tests (cargo test)
just test-coverage # Coverage report (tarpaulin HTML)
just test-integration # API tests (Hurl)
# Frontend tests
# Individual commands
cargo test # Direct unit test execution
hurl --test tests/api/*.hurl # Direct API test execution
# Frontend tests (when implemented)
npm test # Unit tests
npm run test:e2e # End-to-end tests
npm run test:coverage # Coverage report
@ -68,21 +94,30 @@ npm run test:coverage # Coverage report
### Development Server
```bash
# Backend (Rust server)
cargo run
just dev # Run backend server (cargo run)
# Frontend (Vite dev server)
npm run dev
# Other backend commands
just build # Build project
just migrate # Run database migrations
just reset-db # Reset database
just fmt # Format code
just lint # Run clippy
# Frontend (when implemented)
npm run dev # Vite dev server
```
## Current Phase: Core MVP
## Current Phase: Core MVP Backend ✅
**Focus**: Basic task management with CRUD operations
- Task properties: title, description, priority, due_date, status
- Simple web interface with mobile responsiveness
- Testing framework setup with >80% backend coverage target
- RESTful API endpoints for all task operations
**Status**: Backend implementation completed
- ✅ Task properties: title, description, status, timestamps
- ✅ RESTful API endpoints for all task operations
- ✅ Testing framework with unit tests and API integration tests
- ✅ Coverage reporting setup (currently 32.41%)
- ⏳ Frontend implementation (next phase)
See `/plan/01_CORE_MVP/plan.md` for detailed implementation plan.
See `/plan/01_CORE_MVP/backend.md` for implementation details.
See `/plan/future_improvements.md` for architectural enhancement opportunities.
## Future Phases

1
backend/.gitignore vendored
View file

@ -1,4 +1,5 @@
target
coverage
*.db
*.db-shm

1363
backend/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -16,3 +16,5 @@ tracing = "0.1.41"
tracing-subscriber = "0.3.19"
uuid = { version = "1.18.0", features = ["serde", "v4"] }
[dev-dependencies]
cargo-tarpaulin = "0.31"

View file

@ -48,3 +48,6 @@ test-integration:
echo "Running integration tests..."
hurl --test --error-format long --variable host=http://localhost:3000 tests/api/*.hurl
test-coverage:
cargo tarpaulin --out Html --output-dir coverage

View file

@ -0,0 +1,50 @@
# Future Improvements
This document tracks architectural improvements and refactoring opportunities identified during development.
## Architecture Refactoring
### Repository + Service Pattern Migration
**Current State**: Using Active Record pattern where TaskModel handles its own persistence and HTTP handlers contain business logic directly.
**Future Improvement**: Migrate to Repository + Service pattern for better separation of concerns:
```rust
// Repository trait for data access abstraction
trait TaskRepository {
async fn create(&self, task: &NewTask) -> Result<Task>;
async fn find_by_id(&self, id: Uuid) -> Result<Option<Task>>;
async fn update(&self, task: &Task) -> Result<Task>;
async fn delete(&self, id: Uuid) -> Result<()>;
async fn list_all(&self) -> Result<Vec<Task>>;
}
// Service layer for business logic
struct TaskService {
repository: Box<dyn TaskRepository>,
}
impl TaskService {
async fn create_task(&self, title: String, description: Option<String>) -> Result<Task> {
// Input validation
// Business rules (e.g., auto-set completed_at when status changes)
// Call repository
}
}
```
**Benefits**:
- Better testability through repository mocking
- Centralized business logic in service layer
- Cleaner separation between data access, business logic, and HTTP handling
- Easier to add complex business rules as the application grows
**Implementation Plan**:
1. Create TaskRepository trait and SqliteTaskRepository implementation
2. Move database operations from TaskModel to repository
3. Create TaskService with business logic
4. Update HTTP handlers to use services instead of models directly
5. Add comprehensive unit tests for service layer with mocked repositories
**Priority**: Medium - Good for maintainability as the codebase grows, but current Active Record pattern works fine for MVP scope.