SceneController - applebiter/gnatwriter GitHub Wiki
Scene controller encapsulates scene management functionality.
create_scene()
create_scene(
story_id: int, chapter_id: int, title: str,
description: str = None, content: str = None
) -> Scene
Takes a Story id, a Chapter id, and a title at minimum. Also accepts a description and, of course, content. Returns the new Scene.
update_scene()
update_scene(
scene_id: int, title: str, description: str = None,
content: str = None
) -> Type[Scene]
Takes a Scene id and titel at minimum, returns the updated Scene.
change_scene_position()
change_scene_position(scene_id: int, position: int) -> int
When new Scenes are added, they are assigned the next available position. This method takes a Scene id and an arbitrary position assignment (must be in range) and returns the update Scene. The Scene's siblings are also updated to accommodate the new position.
delete_scene()
delete_scene(scene_id: int) -> bool
Takes a Scene id and returns True if the specified Scene is deleted from the database.
count_scenes_by_chapter_id()
count_scenes_by_chapter_id(chapter_id: int) -> int
Takes a Chapter is and returns the number of Scenes belonging to it.
get_scene_by_id()
get_scene_by_id(scene_id: int) -> Type[Scene]
Takes a Scene id and returns the specified Scene if it exists, None otherwise.
get_all_scenes()
get_all_scenes(self) -> List[Type[Scene]]
Returns all Scenes in the database belonging to the user.
get_scenes_by_story_id()
get_scenes_by_story_id(story_id: int) -> List[Type[Scene]]
Takes a Story id and returns a list containing all Scenes belonging to it.
get_scenes_page_by_story_id()
get_scenes_page_by_story_id(story_id: int, page: int, per_page: int) -> List[Type[Scene]]
Takes a Story id, a page number, and an integer describing how many Scenes to return per page. Returns a list containing the Scenes correlating to that page.
get_scenes_by_chapter_id()
get_scenes_by_chapter_id(chapter_id: int) -> List[Type[Scene]]
Takes a Chapter id and returns a list containing its Scenes.
get_scenes_page_by_chapter_id()
get_scenes_page_by_chapter_id(chapter_id: int, page: int, per_page: int) -> List[Type[Scene]]
Takes a Chapter id, a page number, and an integer describing how many Scenes to return per page of results. Returns a list of Scenes representing that page.
search_scenes()
search_scenes(search: str) -> List[Type[Scene]]
Takes a search term and matches it against the title, description, and contents of all Scenes in the database belonging to the user.
append_links_to_scene()
append_links_to_scene(scene_id: int, link_ids: list) -> Type[Scene]
Takes a Scene id and a list containing one or more Link ids. Returns the updated Scene.
get_links_by_scene_id()
get_links_by_scene_id(scene_id: int) -> List[Type[Link]]
Takes a Scene id and returns a list containing all of its associated Links, if any.
append_notes_to_scene()
append_notes_to_scene(scene_id: int, note_ids: list) -> Type[Scene]
Takes a Scene id and a list containing one or more Note ids. Returns the update Scene.
get_notes_by_scene_id()
get_notes_by_scene_id(scene_id: int) -> List[Type[Note]]
Takes a Scene id and returns a list containing all of its associated Notes, if any.