NoteController - applebiter/gnatwriter GitHub Wiki
Note controller encapsulates note management functionality.
create_note()
create_note(title: str, content: str) -> Note
Takes a title and content. Returns a new Note.
update_note()
update_note(note_id: int, title: str, content: str) -> Type[Note]
Takes a Note id, a title, and content. Returns the updated Note.
delete_note_by_id()
delete_note(note_id: int) -> bool
Takes a Note id and returns True if the specified Note is deleted from the database.
get_note_by_id()
get_note_by_id(note_id: int) -> Type[Note] | None
Takes a Note id and returns the matching Note if found, None otherwise.
get_all_notes()
get_all_notes() -> List[Type[Note]]
Returns a list of all Notes in the database belonging to the user.
get_all_notes_page()
get_all_notes_page(page: int, per_page: int) -> List[Type[Note]]
Takes a page number and an integer describing how many Notes to return per page of results. Returns a list of Notes corresponding to the specified page.
search_notes()
search_notes(search: str) -> List[Type[Note]]
Takes a search term and returns a list of all Notes matching the term and belonging to the user.
get_notes_by_story_id()
get_notes_by_story_id(story_id: int) -> List[Type[Note]]
Takes a story id and returns a list of Notes associated with the specified story, if any.
get_notes_by_story_id_page()
get_notes_by_story_id_page(story_id: int, page: int, per_page: int) -> List[Type[Note]]
Takes a story id, a page number, and an integer describing how many notes to return per page of results. Returns a list containing the specified page of results.