Class: EventRepository

EventRepository(database)

EventRepository - Manages event-related data interactions with the database.

Constructor

new EventRepository(database)

Parameters:
Name Type Description
database Object The database connection used for accessing event data.
Source:

Methods

(async) createEvent()

Helper function to create event
Source:

(static) createNewFollowerEvent(followerId, followingId) → {Promise.<string>}

Creates a new follower event in the database.
Parameters:
Name Type Description
followerId string The ID of the follower.
followingId string The ID of the user being followed.
Source:
Returns:
The ID of the created event.
Type
Promise.<string>

(static) createShareFlashcardEvent(sharedBy, sharedWith, itemId) → {Promise.<string>}

Creates a share flashcard event in the database.
Parameters:
Name Type Description
sharedBy string The ID of the user sharing the flashcard.
sharedWith string The ID of the user the flashcard is shared with.
itemId string The ID of the flashcard being shared.
Source:
Returns:
The ID of the created event.
Type
Promise.<string>

(static) createShareQuizEvent(sharedBy, sharedWith, itemId) → {Promise.<string>}

Creates a share quiz event in the database.
Parameters:
Name Type Description
sharedBy string The ID of the user sharing the quiz.
sharedWith string The ID of the user the quiz is shared with.
itemId string The ID of the quiz being shared.
Source:
Returns:
The ID of the created event.
Type
Promise.<string>

(static) createUpcomingEvent(upcomingEvent) → {Promise.<string>}

Creates a new upcoming event in the database.
Parameters:
Name Type Description
upcomingEvent Object The upcoming event object to create.
Source:
Returns:
The ID of the created upcoming event.
Type
Promise.<string>

(static) deleteUpcomingEvent(upcomingEventId)

Deletes a specific upcoming event from the database.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to delete.
Source:

(static) getAllEvents() → {Promise.<Array.<Object>>}

Retrieves all events from the database.
Source:
Returns:
An array of event objects.
Type
Promise.<Array.<Object>>

(static) getAllUpcomingEvents() → {Promise.<Array.<Object>>}

Retrieves all upcoming events from the database.
Source:
Returns:
An array of upcoming event objects.
Type
Promise.<Array.<Object>>

(static) getEventById(id) → {Promise.<Object>}

Retrieves a specific event by its ID.
Parameters:
Name Type Description
id string The ID of the event to retrieve.
Source:
Returns:
The event object.
Type
Promise.<Object>

(static) getUpcomingEventById(upcomingEventId) → {Promise.<Object>}

Retrieves a specific upcoming event by its ID.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to retrieve.
Source:
Returns:
The upcoming event object.
Type
Promise.<Object>

(static) markUpcomingEventAsNotified(upcomingEventId)

Marks a specific upcoming event as having been notified in the database.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to mark as notified.
Source:

(static) updateUpcomingEvent(upcomingEventId, updatedUpcomingEvent)

Updates specific fields of an upcoming event in the database.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to update.
updatedUpcomingEvent Object The updated fields of the upcoming event.
Source:

(static) updateUpcomingEventDate(upcomingEventId, newDate)

Updates the date of a specific upcoming event in the database.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to update.
newDate Date The new date to set for the event.
Source:

(static) updateUpcomingEventName(upcomingEventId, newName)

Updates the name of a specific upcoming event in the database.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to update.
newName string The new name to set for the event.
Source:

(static) updateUpcomingEventTime(upcomingEventId, newTime)

Updates the time of a specific upcoming event in the database.
Parameters:
Name Type Description
upcomingEventId string The ID of the upcoming event to update.
newTime string The new time to set for the event.
Source: