(ctx context.DnoteCtx, tx *database.DB, note database.Note, bookName string)
| 80 | } |
| 81 | |
| 82 | func moveBook(ctx context.DnoteCtx, tx *database.DB, note database.Note, bookName string) error { |
| 83 | targetBookUUID, err := database.GetBookUUID(tx, bookName) |
| 84 | if err != nil { |
| 85 | return errors.Wrap(err, "finding book uuid") |
| 86 | } |
| 87 | |
| 88 | if note.BookUUID == targetBookUUID { |
| 89 | return errors.New("book has not changed") |
| 90 | } |
| 91 | |
| 92 | if err := database.UpdateNoteBook(tx, ctx.Clock, note.RowID, targetBookUUID); err != nil { |
| 93 | return errors.Wrap(err, "moving book") |
| 94 | } |
| 95 | |
| 96 | return nil |
| 97 | } |
| 98 | |
| 99 | func updateNote(ctx context.DnoteCtx, tx *database.DB, note database.Note, bookName, content string) error { |
| 100 | if bookName != "" { |
no test coverage detected