Implement CreateNote
This commit is contained in:
@@ -15,5 +15,11 @@ func NewNoteRepository(store NoteStore) *NoteRepository {
|
||||
}
|
||||
|
||||
func (r *NoteRepository) CreateNote(content string) (models.Note, error) {
|
||||
return models.Note{}, fmt.Errorf("not implemented")
|
||||
if content == "" {
|
||||
return models.Note{}, fmt.Errorf("content cannot be empty")
|
||||
}
|
||||
note := models.Note{
|
||||
Content: content,
|
||||
}
|
||||
return r.store.SaveNote(note)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user