Adding structure and testing around title support

This commit is contained in:
2026-03-18 22:22:04 +00:00
parent 0935788b69
commit 8749ff3c03
4 changed files with 147 additions and 29 deletions

View File

@@ -13,13 +13,18 @@ type NoteRepository struct {
store NoteStore
}
type NoteUpdate struct {
Title string
Content string
}
// NewNoteRepository creates and returns a new NoteRepository instance.
func NewNoteRepository(store NoteStore) *NoteRepository {
return &NoteRepository{store: store}
}
// CreateNote creates a new note with the given content.
func (r *NoteRepository) CreateNote(ctx context.Context, content string) (models.Note, error) {
func (r *NoteRepository) CreateNote(ctx context.Context, title string, content string) (models.Note, error) {
if content == "" {
return models.Note{}, fmt.Errorf("content cannot be empty")
}