Adding structure and testing around title support
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user