Show top-level title in seach, hide to-do's.

This commit is contained in:
Sergio Martínez Portela 2022-10-18 23:13:21 +02:00
parent 7bad44cfb6
commit d71c28d1e8
3 changed files with 28 additions and 5 deletions

View file

@ -64,7 +64,7 @@ func main() {
query := c.Query("q")
stm, err := db.Prepare("SELECT note_id, title FROM note_search WHERE title LIKE ?")
stm, err := db.Prepare("SELECT note_id, title, top_level_title, is_done, is_todo FROM note_search WHERE title LIKE ?")
if err != nil {
log.Fatal(err)
@ -90,8 +90,17 @@ func main() {
for rows.Next() {
var note_id string
var note_title string
var note_top_level_title string
var note_is_done string
var note_is_todo string
err = rows.Scan(&note_id, &note_title)
err = rows.Scan(
&note_id,
&note_title,
&note_top_level_title,
&note_is_done,
&note_is_todo,
)
if err != nil {
log.Fatal(err)
c.JSON(500, gin.H{
@ -104,6 +113,9 @@ func main() {
item := make(map[string]string)
item["id"] = note_id
item["title"] = note_title
item["top_level_title"] = note_top_level_title
item["is_done"] = note_is_done
item["is_todo"] = note_is_todo
results = append(results, item)
}