Class: StoryAPI

StoryAPI()

This class contains all the database functions for the stories

Constructor

new StoryAPI()

Source:

Methods

(async) addStory(story) → {story}

This function adds the story to the stories collection and transforms the story object to fit in the currentStories collection. Finally it links an event to the story if provided.

Parameters:
Name Type Description
story story
Source:
Throws:
  • Will throw an error if the club is not found

  • Will throw an error if a event to be linked is not found

Returns:

created story

Type
story

(async) deleteStory(story) → {Object}

This function deletes the story from both the stories and currentStories collection.

Parameters:
Name Type Description
story story
Source:
Throws:

Will throw an error if the story is not found

Returns:

A success response if the story is deleted successfully

Type
Object

(async) getCurrentStories() → {currentStories}

This function fetches all the active stories from the database. It fetches all the current stories from the currentStories collection and groups them club wise *

Source:
Returns:

array of current stories grouped club wise

Type
currentStories