diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-20 21:07:36 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-20 21:07:36 -1000 |
| commit | a38ce269cc9283556621b5447eb3a0caf697eae9 (patch) | |
| tree | 28727aada058e8ec4c01d170f79bf7aaa2ab1201 /internal/store/sqlite.go | |
| parent | 093ad56d8cb7274627a43004c95f4a5dd6b94fb7 (diff) | |
Add in-app bug reporting feature
- New bugs table in SQLite (migration 005)
- Store methods for saving and retrieving bugs
- Handlers for GET/POST /bugs
- Floating bug button with modal UI
- Shows recent bug reports in modal
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/store/sqlite.go')
| -rw-r--r-- | internal/store/sqlite.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/internal/store/sqlite.go b/internal/store/sqlite.go index 7961f35..8640b9b 100644 --- a/internal/store/sqlite.go +++ b/internal/store/sqlite.go @@ -541,3 +541,35 @@ func (s *Store) ClearSyncToken(service string) error { _, err := s.db.Exec(`DELETE FROM sync_tokens WHERE service = ?`, service) return err } + +// Bug represents a user-reported bug +type Bug struct { + ID int64 + Description string + CreatedAt time.Time +} + +// SaveBug saves a new bug report +func (s *Store) SaveBug(description string) error { + _, err := s.db.Exec(`INSERT INTO bugs (description) VALUES (?)`, description) + return err +} + +// GetBugs retrieves all bugs, newest first +func (s *Store) GetBugs() ([]Bug, error) { + rows, err := s.db.Query(`SELECT id, description, created_at FROM bugs ORDER BY created_at DESC`) + if err != nil { + return nil, err + } + defer rows.Close() + + var bugs []Bug + for rows.Next() { + var b Bug + if err := rows.Scan(&b.ID, &b.Description, &b.CreatedAt); err != nil { + return nil, err + } + bugs = append(bugs, b) + } + return bugs, rows.Err() +} |
