feat: ship v0.9.0 with pomodoro, achievements, and injection history
Add pomodoro timer with goal notifications, writing streak milestones, and knowledge injection logging with UI previews across AI writing flows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import type { DatabaseSync } from 'node:sqlite'
|
||||
import { localDateString } from '../../services/writing-date.util'
|
||||
|
||||
export class PomodoroDailyRepository {
|
||||
constructor(private db: DatabaseSync) {}
|
||||
|
||||
recordComplete(bookId: string, wordDelta: number, date = localDateString()): void {
|
||||
this.db
|
||||
.prepare(
|
||||
`INSERT INTO pomodoro_daily (date, book_id, completed_count, total_words)
|
||||
VALUES (?, ?, 1, ?)
|
||||
ON CONFLICT(date, book_id) DO UPDATE SET
|
||||
completed_count = completed_count + 1,
|
||||
total_words = total_words + excluded.total_words`
|
||||
)
|
||||
.run(date, bookId, wordDelta)
|
||||
}
|
||||
|
||||
getTodayCount(bookId: string, date = localDateString()): number {
|
||||
const row = this.db
|
||||
.prepare('SELECT completed_count FROM pomodoro_daily WHERE date = ? AND book_id = ?')
|
||||
.get(date, bookId) as { completed_count: number } | undefined
|
||||
return row?.completed_count ?? 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user