Class: FlashcardRepo

FlashcardRepo()

FlashcardRepo

Constructor

new FlashcardRepo()

Repository for handling flashcard-related operations with Firebase.
Source:

Methods

(static) addComment(setId, commentData) → {Promise.<void>}

Adds a new comment to a flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
commentData Object The data of the new comment.
Source:
Returns:
Type
Promise.<void>

(static) addFlashcardItem(setId, term, definition) → {Promise.<string>}

Adds a new flashcard item to a specified flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
term string The term of the new flashcard.
definition string The definition of the new flashcard.
Source:
Returns:
A promise that resolves to the ID of the newly added flashcard item.
Type
Promise.<string>

(static) addOwnedFlashcardSetToUser(uid, flashcardSetId) → {Promise.<void>}

Adds a flashcard set to the list of sets owned by a user.
Parameters:
Name Type Description
uid string The user's UID.
flashcardSetId string The ID of the flashcard set.
Source:
Returns:
Type
Promise.<void>

(static) addOwnedQuizSetToUser(uid, quizSetId) → {Promise.<void>}

Adds a quiz set to a user's list of owned quizzes.
Parameters:
Name Type Description
uid string The UID of the user.
quizSetId string The ID of the quiz set to add.
Source:
Returns:
Type
Promise.<void>

(static) addQuizQuestion(setId, question, choices, correctChoiceIndex) → {Promise.<string>}

Adds a new question to a quiz set.
Parameters:
Name Type Description
setId string The ID of the quiz set.
question string The question text.
choices Array.<string> An array of choices for the question.
correctChoiceIndex number The index of the correct choice.
Source:
Returns:
A promise that resolves to the ID of the newly added question.
Type
Promise.<string>

(static) addUserSubject(uid, newSubject) → {Promise.<void>}

Adds a new subject to a user's list of subjects.
Parameters:
Name Type Description
uid string The UID of the user.
newSubject string The new subject to add.
Source:
Returns:
Type
Promise.<void>

(static) copyFlashcards(flashcardId, userId) → {Promise.<(string|null)>}

Copies a flashcard set to a new user.
Parameters:
Name Type Description
flashcardId string The ID of the flashcard set to copy.
userId string The ID of the user to copy the flashcard set to.
Source:
Returns:
A promise that resolves to the new flashcard set ID or null if failed.
Type
Promise.<(string|null)>

(static) createFlashcardSet(setDetails) → {Promise.<Object>}

Creates a new flashcard set with given parameters.
Parameters:
Name Type Description
setDetails Object The details of the flashcard set including name and subject.
Source:
Returns:
A promise that resolves to the new flashcard set's ID.
Type
Promise.<Object>

(static) createNewQuiz(flashcardSetId, quizTitle) → {Promise.<string>}

Creates a new quiz associated with a flashcard set.
Parameters:
Name Type Description
flashcardSetId string The ID of the flashcard set.
quizTitle string The title of the new quiz.
Source:
Returns:
A promise that resolves to the ID of the newly created quiz.
Type
Promise.<string>

(static) deleteFlashcard(setId, flashcardIdToDelete) → {Promise.<void>}

Deletes a specific flashcard from a flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
flashcardIdToDelete string The ID of the flashcard to delete.
Source:
Returns:
Type
Promise.<void>

(static) deleteQuestion(setId, questionIdToBeDeleted) → {Promise.<void>}

Deletes a question from a quiz set.
Parameters:
Name Type Description
setId string The ID of the quiz set.
questionIdToBeDeleted string The ID of the question to delete.
Source:
Returns:
Type
Promise.<void>

(static) deleteQuiz(quizIdToBeDeleted, uid) → {Promise.<void>}

Deletes a quiz.
Parameters:
Name Type Description
quizIdToBeDeleted string The ID of the quiz to be deleted.
uid string The UID of the user performing the action.
Source:
Returns:
Type
Promise.<void>

(static) getCommentsWithUserData(setId) → {Promise.<Array>}

Retrieves all comments for a flashcard set along with user data.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
Source:
Returns:
A promise that resolves to an array of comments with user data.
Type
Promise.<Array>

(static) getCurrentUid() → {string|null}

Retrieves the current user's UID.
Source:
Returns:
The current user's UID or null if not logged in.
Type
string | null

(static) getFlashcardItems(setId) → {Promise.<Object>}

Retrieves all flashcard items in a specific flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
Source:
Returns:
A promise that resolves to an object containing flashcard items.
Type
Promise.<Object>

(static) getFlashcardItemsByStatus(setId, status) → {Promise.<Array>}

Retrieves flashcard items from a set filtered by a specific status.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
status string The status to filter by.
Source:
Returns:
A promise that resolves to an array of flashcards with the specified status.
Type
Promise.<Array>

(static) getFlashcardSetById(setId) → {Promise.<Object>}

Fetches a flashcard set by its ID.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
Source:
Returns:
A promise that resolves to the flashcard set object.
Type
Promise.<Object>

(static) getQuestionItems(setId) → {Promise.<Object>}

Retrieves all question items from a quiz set.
Parameters:
Name Type Description
setId string The ID of the quiz set.
Source:
Returns:
A promise that resolves to an object containing question items.
Type
Promise.<Object>

(static) getQuizIdByTopicName(topicName) → {Promise.<(string|null)>}

Retrieves the ID of a quiz by its topic name.
Parameters:
Name Type Description
topicName string The topic name of the quiz.
Source:
Returns:
A promise that resolves to the quiz ID or null if not found.
Type
Promise.<(string|null)>

(static) getQuizTitleFromFlashcardSet(flashcardSetId) → {Promise.<Array.<string>>}

Retrieves all quiz titles from a flashcard set.
Parameters:
Name Type Description
flashcardSetId string The ID of the flashcard set.
Source:
Returns:
A promise that resolves to an array of quiz titles.
Type
Promise.<Array.<string>>

(static) getQuizTitleId(quizName, flashcardSetId) → {Promise.<(string|null)>}

Retrieves the ID of a quiz by its title and associated flashcard set ID.
Parameters:
Name Type Description
quizName string The name of the quiz.
flashcardSetId string The ID of the associated flashcard set.
Source:
Returns:
A promise that resolves to the quiz ID or null if not found.
Type
Promise.<(string|null)>

(static) getSetIdByQuizId(quizId) → {Promise.<(string|null)>}

Retrieves the ID of the flashcard set associated with a quiz.
Parameters:
Name Type Description
quizId string The ID of the quiz.
Source:
Returns:
A promise that resolves to the flashcard set ID or null if not found.
Type
Promise.<(string|null)>

(static) getSetIdByTopicName(topicName) → {Promise.<(string|null)>}

Retrieves the ID of a flashcard set by its topic name.
Parameters:
Name Type Description
topicName string The name of the topic.
Source:
Returns:
A promise that resolves to the flashcard set ID or null if not found.
Type
Promise.<(string|null)>

(static) getUserFlashcardSets(uid) → {Promise.<Array>}

Retrieves flashcard sets owned by a specific user.
Parameters:
Name Type Description
uid string The user's UID.
Source:
Returns:
A promise that resolves to an array of flashcard sets.
Type
Promise.<Array>

(static) getUserImageURLByUid(uid) → {Promise.<(string|null)>}

Retrieves the image URL of a user based on their UID.
Parameters:
Name Type Description
uid string The UID of the user.
Source:
Returns:
A promise that resolves to the user's image URL or null if not found.
Type
Promise.<(string|null)>

(static) getUserSubjects(uid) → {Promise.<Array>}

Fetches subjects associated with a specific user.
Parameters:
Name Type Description
uid string The user's UID.
Source:
Returns:
A promise that resolves to an array of subjects.
Type
Promise.<Array>

(static) removeOwnedQuizFromUser(uid, quizIdToBeDeleted) → {Promise.<void>}

Removes an owned quiz from a user's list.
Parameters:
Name Type Description
uid string The UID of the user.
quizIdToBeDeleted string The ID of the quiz to be removed.
Source:
Returns:
Type
Promise.<void>

(static) removeSetIdFromUser(uid, setId) → {Promise.<void>}

Removes a flashcard set ID from a user's list of owned flashcard sets.
Parameters:
Name Type Description
uid string The UID of the user.
setId string The ID of the flashcard set to remove.
Source:
Returns:
Type
Promise.<void>

(static) removeUidFromSharedWith(setId, uid) → {Promise.<void>}

Removes a user's UID from the 'sharedWith' list of a flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
uid string The UID of the user to remove.
Source:
Returns:
Type
Promise.<void>

(static) updateCardStatus(setId, flashcardId, newStatus) → {Promise.<void>}

Updates the status of a specific flashcard in a set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
flashcardId string The ID of the flashcard to update.
newStatus string The new status for the flashcard.
Source:
Returns:
Type
Promise.<void>

(static) updateFlashcard(setId, flashcardIdToUpdate, newTerm, newDefinition) → {Promise.<void>}

Updates the term and definition of a specific flashcard in a set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
flashcardIdToUpdate string The ID of the flashcard to update.
newTerm string The new term for the flashcard.
newDefinition string The new definition for the flashcard.
Source:
Returns:
Type
Promise.<void>

(static) updateFlashcardSetName(setId, newName) → {Promise.<void>}

Updates the name of a specified flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
newName string The new name for the flashcard set.
Source:
Returns:
Type
Promise.<void>

(static) updateLikesForComment(setId, commentId, updatedLikes) → {Promise.<void>}

Updates the like count for a specific comment in a flashcard set.
Parameters:
Name Type Description
setId string The ID of the flashcard set.
commentId string The ID of the comment.
updatedLikes number The updated like count.
Source:
Returns:
Type
Promise.<void>

(static) updateQuestion(setId, questionToBeUpdated, newQuestion, newChoices, newCorrectChoiceIndex) → {Promise.<void>}

Updates an existing question in a quiz set.
Parameters:
Name Type Description
setId string The ID of the quiz set.
questionToBeUpdated string The ID of the question to update.
newQuestion string The new question text.
newChoices Array.<string> The new array of choices.
newCorrectChoiceIndex number The index of the new correct choice.
Source:
Returns:
Type
Promise.<void>

(static) updateQuizTitle(quizId, newTitle) → {Promise.<void>}

Updates the title of a quiz.
Parameters:
Name Type Description
quizId string The ID of the quiz to update.
newTitle string The new title of the quiz.
Source:
Returns:
Type
Promise.<void>