Skip to content

Kanji Karma Database Schema and Backend Routes

Christian Cozma edited this page Jun 4, 2021 · 9 revisions

Database schema

Link to the schema: Kanji Karma Schema

Database Schema

Backend API Routes

Users

GET /api/users/

  • Returns the information for all users

GET /api/users/:id

  • Returns the information for one user

Sessions

GET /api/auth/

  • Returns the information for the logged in user

POST /api/auth/signup

  • Signs a new user up

POST /api/auth/login

  • Logs a user in

DELETE /api/auth/

  • Logs a user out

Decks

GET /api/decks/

  • Returns all decks that a logged-in user owns.

GET /api/decks/:id

  • Returns a specific deck that a logged-in user owns.

POST /api/decks/

  • Allows a user to create a new deck on their profile.

POST /api/decks/:id

  • Allows a logged-in user to add a Kanji Character to a specific deck on their profile. Whether that is their "main" general deck or a specifically chosen side deck on their profile.

PUT /api/decks/:id

  • Allows a logged-in user to edit their deck.

DELETE /api/decks/:id

  • Allows a logged-in user to delete a deck from their profile.

DELETE /api/decks/:id/remove-char

  • Allows a logged-in user to delete a character in a deck of theirs.

DELETE /api/decks/:id/remove-all

  • Allows a logged-in user to delete all of the cards that belong to a deck, without deleting the deck itself.

Search Kanji Characters

GET /api/search/:query

  • Returns a modal with the single kanji character that a user searched for that is found in the database.

GET /api/search/:query/words

  • Returns a list of all of the Kanji characters whose meanings' match the search term in the query that are found in the database

Kanji Character

GET /api/character/:id

  • Get a kanji character info box

DELETE /api/character/:id

  • Allows a logged-in user to delete a kanji character infobox from their profile or their deck.