diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-01-20 11:17:19 -1000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-01-20 11:17:19 -1000 |
| commit | 07ba815e8517ee2d3a5fa531361bbd09bdfcbaa7 (patch) | |
| tree | ca9d9be0f02d5a724a3646f87d4a9f50203249cc /internal/store/sqlite.go | |
| parent | 6a59098c3096f5ebd3a61ef5268cbd480b0f1519 (diff) | |
Remove Obsidian integration for public server deployment
Obsidian relied on local filesystem access which is incompatible with
public server deployment. This removes all Obsidian-related code including:
- API client and interface
- Store layer methods (SaveNotes, GetNotes, SearchNotes)
- Handler methods and routes
- UI tab and templates
- Configuration fields
- Related tests
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'internal/store/sqlite.go')
| -rw-r--r-- | internal/store/sqlite.go | 124 |
1 files changed, 2 insertions, 122 deletions
diff --git a/internal/store/sqlite.go b/internal/store/sqlite.go index b8d0c97..dac3321 100644 --- a/internal/store/sqlite.go +++ b/internal/store/sqlite.go @@ -15,9 +15,8 @@ import ( // Cache key constants const ( - CacheKeyTodoistTasks = "todoist_tasks" - CacheKeyTrelloBoards = "trello_boards" - CacheKeyObsidianNotes = "obsidian_notes" + CacheKeyTodoistTasks = "todoist_tasks" + CacheKeyTrelloBoards = "trello_boards" CacheKeyPlanToEatMeals = "plantoeat_meals" ) @@ -234,125 +233,6 @@ func (s *Store) DeleteTasksByIDs(ids []string) error { return tx.Commit() } -// Notes operations - -// SaveNotes saves multiple notes to the database -func (s *Store) SaveNotes(notes []models.Note) error { - tx, err := s.db.Begin() - if err != nil { - return err - } - defer tx.Rollback() - - stmt, err := tx.Prepare(` - INSERT OR REPLACE INTO notes - (filename, title, content, modified, path, tags, updated_at) - VALUES (?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP) - `) - if err != nil { - return err - } - defer stmt.Close() - - for _, note := range notes { - tagsJSON, _ := json.Marshal(note.Tags) - _, err := stmt.Exec( - note.Filename, - note.Title, - note.Content, - note.Modified, - note.Path, - string(tagsJSON), - ) - if err != nil { - return err - } - } - - return tx.Commit() -} - -// GetNotes retrieves all notes from the database -func (s *Store) GetNotes(limit int) ([]models.Note, error) { - query := ` - SELECT filename, title, content, modified, path, tags - FROM notes - ORDER BY modified DESC - ` - var args []interface{} - if limit > 0 { - query += " LIMIT ?" - args = append(args, limit) - } - - rows, err := s.db.Query(query, args...) - if err != nil { - return nil, err - } - defer rows.Close() - - var notes []models.Note - for rows.Next() { - var note models.Note - var tagsJSON string - - err := rows.Scan( - ¬e.Filename, - ¬e.Title, - ¬e.Content, - ¬e.Modified, - ¬e.Path, - &tagsJSON, - ) - if err != nil { - return nil, err - } - - json.Unmarshal([]byte(tagsJSON), ¬e.Tags) - notes = append(notes, note) - } - - return notes, rows.Err() -} - -// SearchNotes searches notes by title or content -func (s *Store) SearchNotes(query string) ([]models.Note, error) { - searchPattern := "%" + query + "%" - rows, err := s.db.Query(` - SELECT filename, title, content, modified, path, tags - FROM notes - WHERE title LIKE ? OR content LIKE ? - ORDER BY modified DESC - `, searchPattern, searchPattern) - if err != nil { - return nil, err - } - defer rows.Close() - - var notes []models.Note - for rows.Next() { - var note models.Note - var tagsJSON string - - err := rows.Scan( - ¬e.Filename, - ¬e.Title, - ¬e.Content, - ¬e.Modified, - ¬e.Path, - &tagsJSON, - ) - if err != nil { - return nil, err - } - - json.Unmarshal([]byte(tagsJSON), ¬e.Tags) - notes = append(notes, note) - } - - return notes, rows.Err() -} - // Meals operations // SaveMeals saves multiple meals to the database |
