Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Routes

  • /auth
  • /user
  • /profile
  • /subscription
  • /serie
  • /favorite
  • /category
  • /rating

Models & CRUD endpoints

Below each model is equivalent to a Database's table with its fields and data parameters.

User
  • id ( type: INTEGER, primaryKey: true, autoIncrement: true, allowNull: true )
  • subscriptionId (type: INTEGER, foreignKey: true, allowNull: false)
  • profileId (type: INTEGER, foreignKey: true, allowNull: false)
  • email (type: INTEGER, allowNull: false, unique: true, validate: isEmail)
  • password (type: STRING, allowNull: false, validate: regex (Minimum four characters, at least one uppercase letter, one lowercase letter and one number))
  • role (type: ENUM('user', 'admin'), allowNull: false)

Auth

ROUTE /auth

POST: '/signup' => signUp
POST: '/login'  => logIn

CRUD

ROUTE /user

GET:    '/:userId'  => checkAuth, isAdmin, getUser
GET:    '/'         => checkAuth, getMyUser
PATCH:  '/'  => checkAuth, updateUser
DELETE: '/:userId'  => checkAuth, deleteUser
DO

➡️ User can signup

➡️ User can login

➡️ User can see their own info

➡️ User can modify their own info

➡️ User can delete theirself

Subscription
  • id (type: INTEGER, primaryKey: true, autoIncrement: true, allowNull: true)
  • type (type: ENUM('month', 'year'), allowNull: false)
  • name (type: VARCHAR, allowNull: false)

CRUD

ROUTE /subscription

GET:    '/'         => getAllSubscriptions
POST:   '/:userId'  => checkAuth, subscribe
DELETE: '/:userId'  => checkAuth, unSubscribe

DO

➡️ User can subscribe

➡️ User can unsubscribe

Profile
  • id (type: INTEGER, primaryKey: true, autoIncrement: true, allowNull: true)
  • nick (type: VARCHAR, allowNull: false, unique: true)
  • profileimage (type: VARCHAR, allowNull: true)

CRUD

ROUTE /profile

GET:    '/:userId'  => checkAuth, getProfile
POST:   '/:userId'     => checkAuth, createProfile
PATCH:  '/:profileId'  => checkAuth, updateProfile
DELETE: '/:profileId'  => checkAuth, deleteProfile
DO

➡️ User can see their own profile

➡️ User can create their own profile

➡️ User can modify their own profile

Category
  • id (type: INTEGER, primaryKey: true, autoIncrement: true, allowNull: true)
  • name (type: VARCHAR, allowNull: false)

CRUD

ROUTE /category

GET:    '/'            => checkAuth, getAllCategories
GET:    '/:categoryId' => checkAuth, getOneCategory
POST:   '/'            => checkAuth, createCategory
DELETE: '/:categoryId' => checkAuth, deleteCategory
Series
  • id (type: INTEGER, primaryKey: true, autoIncrement: true, allowNull: true)
  • categoryId (type: INTEGER, foreignKey: true, allowNull: false)
  • title (type: VARCHAR, allowNull: false, unique: true)
  • description (type: TEXT, allowNull: true)
  • duration (type: VARCHAR, allowNull: false)
  • rating (type: INTEGER, allowNull: true)

CRUD

ROUTE /serie

GET:    '/:serieId'               => checkAuth, getOneSerie
GET:    '/'                       => checkAuth, getAllSeries
GET:    '/categoryId/:categoryId' => checkAuth, getSeriesByCategory
POST:   '/'                       => checkAuth, isAdmin, createSerie
PATCH:  '/:serieId'               => checkAuth, updateSerie

DO

➡️ User can see all series

➡️ User can see one serie

➡️ User can create one serie

➡️ User can update one serie

Favorite
  • serieId (type: INTEGER, foreignKey: true, allowNull: false)
  • userId (type: INTEGER, foreignKey: true, allowNull: false)

CRUD

ROUTE /favorite

GET:    '/:userId'                => checkAuth, getFavorites
POST:   '/:userId/serie/:serieId' => checkAuth, addFavorite
DELETE: '/:userId/serie/:serieId' => checkAuth, deleteFavorite

DO

➡️ User can see all their favs series

➡️ User can add one serie to favs

Rating
  • id (type: INTEGER, primaryKey: true, autoIncrement: true, allowNull: true)
  • serieId (type: INTEGER, foreignKey: true, allowNull: false)
  • userId (type: INTEGER, foreignKey: true, allowNull: false)
  • rate (type: INTEGER, allowNull: false)
  • comment (type: VARCHAR, allowNull: true)

CRUD

ROUTE /rating

GET:    '/:serieId'  => checkAuth, getRating
POST:   '/:serieId'  => checkAuth, createRating
PATCH:  '/:ratingId' => checkAuth, updateRating
DELETE: '/:ratingId' => checkAuth, deleteRating

DO

➡️ User can create a serie's rating

➡️ User can get one rating

➡️ User can update rating

➡️ User can delete rating

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages