Files
voice-to-notes/src-tauri/src/db/models.rs
Josh Knapp 503cc6c0cf Phase 1 foundation: Tauri shell, Python sidecar, SQLite database
Tauri v2 + Svelte + TypeScript frontend:
- App shell with workspace layout (waveform, transcript, speakers, AI chat)
- Placeholder components for all major UI areas
- Typed stores (project, transcript, playback, AI)
- TypeScript interfaces matching the database schema
- Tauri bridge service with typed invoke wrappers
- svelte-check passes with 0 errors

Rust backend:
- Tauri v2 app entry point with command registration
- SQLite database layer (rusqlite with bundled SQLite)
  - Full schema: projects, media_files, speakers, segments, words,
    ai_outputs, annotations (with indexes)
  - Model structs with serde serialization
  - CRUD queries for projects, speakers, segments, words
  - Segment text editing preserves original text
  - Schema versioning for future migrations
  - 6 tests passing
- Command stubs for project, transcribe, export, AI, settings, system
- App state management

Python sidecar:
- JSON-line IPC protocol (stdin/stdout)
- Message types: IPCMessage, progress, error, ready
- Handler registry with routing and error handling
- Ping/pong handler for connectivity testing
- Service stubs: transcribe, diarize, pipeline, AI, export
- Provider stubs: local (llama-server), OpenAI, Anthropic, LiteLLM
- Hardware detection stubs
- 14 tests passing, ruff clean

Also adds:
- Testing strategy document (docs/TESTING.md)
- Validation script (scripts/validate.sh)
- Updated .gitignore for Svelte, Rust, Python artifacts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 15:16:06 -08:00

85 lines
2.0 KiB
Rust

use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Project {
pub id: String,
pub name: String,
pub created_at: String,
pub updated_at: String,
pub settings: Option<String>,
pub status: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MediaFile {
pub id: String,
pub project_id: String,
pub file_path: String,
pub file_hash: Option<String>,
pub duration_ms: Option<i64>,
pub sample_rate: Option<i32>,
pub channels: Option<i32>,
pub format: Option<String>,
pub file_size: Option<i64>,
pub created_at: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Speaker {
pub id: String,
pub project_id: String,
pub label: String,
pub display_name: Option<String>,
pub color: Option<String>,
pub metadata: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Segment {
pub id: String,
pub project_id: String,
pub media_file_id: String,
pub speaker_id: Option<String>,
pub start_ms: i64,
pub end_ms: i64,
pub text: String,
pub original_text: Option<String>,
pub confidence: Option<f64>,
pub is_edited: bool,
pub edited_at: Option<String>,
pub segment_index: i32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Word {
pub id: String,
pub segment_id: String,
pub word: String,
pub start_ms: i64,
pub end_ms: i64,
pub confidence: Option<f64>,
pub word_index: i32,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AiOutput {
pub id: String,
pub project_id: String,
pub output_type: String,
pub prompt: Option<String>,
pub content: String,
pub provider: Option<String>,
pub created_at: String,
pub metadata: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Annotation {
pub id: String,
pub project_id: String,
pub start_ms: i64,
pub end_ms: Option<i64>,
pub text: String,
pub annotation_type: String,
}