Contextualise all the things ....
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
// Context imported for interface matching but not used
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"git.hrafn.xyz/aether/notes/internal/models"
|
||||
@@ -10,7 +12,7 @@ type mockNoteStore struct {
|
||||
Notes []models.Note
|
||||
}
|
||||
|
||||
func (m *mockNoteStore) SaveNote(note models.Note) (models.Note, error) {
|
||||
func (m *mockNoteStore) SaveNote(ctx context.Context, note models.Note) (models.Note, error) {
|
||||
// Save a note
|
||||
if note.ID == 0 {
|
||||
note.ID = len(m.Notes) + 1
|
||||
@@ -26,7 +28,7 @@ func (m *mockNoteStore) SaveNote(note models.Note) (models.Note, error) {
|
||||
return note, nil
|
||||
}
|
||||
|
||||
func (m *mockNoteStore) GetNoteByID(id int) (models.Note, error) {
|
||||
func (m *mockNoteStore) GetNoteByID(ctx context.Context, id int) (models.Note, error) {
|
||||
note, _, err := m.getNoteAndIndexByID(id)
|
||||
if err != nil {
|
||||
return models.Note{}, err
|
||||
@@ -43,11 +45,11 @@ func (m *mockNoteStore) getNoteAndIndexByID(id int) (models.Note, int, error) {
|
||||
return models.Note{}, -1, fmt.Errorf("note with ID %d not found", id)
|
||||
}
|
||||
|
||||
func (m *mockNoteStore) GetAllNotes() ([]models.Note, error) {
|
||||
func (m *mockNoteStore) GetAllNotes(ctx context.Context) ([]models.Note, error) {
|
||||
return m.Notes, nil
|
||||
}
|
||||
|
||||
func (m *mockNoteStore) DeleteNoteByID(id int) error {
|
||||
func (m *mockNoteStore) DeleteNoteByID(ctx context.Context, id int) error {
|
||||
_, index, err := m.getNoteAndIndexByID(id)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user