Welcome to FlashCards Backend’s documentation!

API Documentation

API Module

src.api.create_app()[source]

Create Flask application.

Authentication Module

import dependancies

src.auth.routes.index()[source]
src.auth.routes.login()[source]

this method is used by registered users to sign in to their account

POST /login [email, password] payload: { email: “string”, password: “string” }

src.auth.routes.signup()[source]

this method is used to create new users and register them in firebase

POST /signup [email, password] payload: { email: “string”, password: “string” }

Cards Module

routes.py is a file in cards folder that has all the functions defined that manipulate the cards. All CRUD functions that needs to be performed on cards are defined here.

src.cards.routes.createcards(deckId)[source]

This method is routed when the user requests to create new cards in a deck. Only the deckid is required to add cards to a deck.

src.cards.routes.deletecard(id, cardid)[source]

This method is called when the user requests to delete the card. The deckid and the particular cardid is required to delete the card.

src.cards.routes.getcards(deckId)[source]

This method is called when the user want to fetch all of the cards in a deck. Only the deckid is required to fetch all cards from the required deck.

src.cards.routes.updatecard(id, cardid)[source]

This method is called when the user requests to update cards in a deck. The card can be updated in terms of its word and meaning. Here deckid and cardid is required to uniquely identify a updating card.

Deck Module

routes.py is a file in deck folder that has all the functions defined that manipulate the deck. All CRUD functions are defined here.

src.deck.routes.create()[source]

Create a new deck.

src.deck.routes.delete(id)[source]

Delete a deck.

src.deck.routes.export_deck(id)[source]

Export a deck and its cards to a JSON file

src.deck.routes.get_deck_stats(id)[source]

This method calculates stats of a specific deck by its ID.

src.deck.routes.get_leaderboard(deckId)[source]

This endpoint fetches the leaderboard data for a specific deck.

src.deck.routes.get_practice_cards(deck_id, user_id)[source]

Get cards due for review using spaced repetition

src.deck.routes.get_user_score(deckId, userId)[source]

This endpoint fetches the user’s score for a specific deck. If the user doesn’t exist, return zero for all score values.

src.deck.routes.getdeck(id)[source]

This method fetches a specific deck by its ID.

src.deck.routes.getdecks()[source]

Fetch all decks. Shows private decks for authenticated users and public decks for non-authenticated users.

src.deck.routes.import_deck()[source]

Import a deck and its cards from a JSON file

src.deck.routes.practice_schedule(deck_id, user_id)[source]

Get the practice schedule for future iterations of cards

src.deck.routes.record_answer(user_id)[source]

Update card progress using SM-2 algorithm with frontend-provided ease

src.deck.routes.update(id)[source]

Update an existing deck.

src.deck.routes.update_last_opened(id)[source]

Update the lastOpened timestamp when a deck is opened.

src.deck.routes.update_leaderboard(deck_id)[source]

Folders Module

routes.py is a file in the folder folder that has all the functions defined that manipulate folders. All CRUD functions are defined here.

src.folders.routes.adddecktofolder()[source]

This method allows the user to add a deck to a folder by folderId and deckId.

POST /deck/add-deck payload: { folderId: “string”, deckId: “string” }

src.folders.routes.createfolder()[source]

POST /folder/create payload: { name: “string”, userId: “string” }

src.folders.routes.deletefolder(id)[source]

This method is called when the user requests to delete a folder.

DELETE /folder/delete/{id}

src.folders.routes.get_decks_for_folder(folder_id)[source]

This method is called to fetch all decks for a specific folder.

GET /decks/{folder_id}

src.folders.routes.getfolder(id)[source]

This method is called when we want to fetch one of the folders by folder ID

GET /folder/{id}

src.folders.routes.getfolders()[source]

This method is called when we want to fetch all folders for a specific user

GET /folders/all

src.folders.routes.removedeckfromfolder()[source]

This method allows the user to remove a deck from a folder by folderId and deckId.

DELETE /folder/remove-deck payload: { folderId: “string”, deckId: “string” }

src.folders.routes.updatefolder(id)[source]

This method is called when the user wants to update a folder’s name.

PATCH /folder/update/{id} payload: { name: “string” }

Indices and tables