- /auth
- /user
- /profile
- /subscription
- /serie
- /favorite
- /category
- /rating
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)
ROUTE /auth
POST: '/signup' => signUp
POST: '/login' => logInROUTE /user
GET: '/:userId' => checkAuth, isAdmin, getUser
GET: '/' => checkAuth, getMyUser
PATCH: '/' => checkAuth, updateUser
DELETE: '/:userId' => checkAuth, deleteUser➡️ 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)
ROUTE /subscription
GET: '/' => getAllSubscriptions
POST: '/:userId' => checkAuth, subscribe
DELETE: '/:userId' => checkAuth, unSubscribe➡️ 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)
ROUTE /profile
GET: '/:userId' => checkAuth, getProfile
POST: '/:userId' => checkAuth, createProfile
PATCH: '/:profileId' => checkAuth, updateProfile
DELETE: '/:profileId' => checkAuth, deleteProfile➡️ 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)
ROUTE /category
GET: '/' => checkAuth, getAllCategories
GET: '/:categoryId' => checkAuth, getOneCategory
POST: '/' => checkAuth, createCategory
DELETE: '/:categoryId' => checkAuth, deleteCategorySeries
- 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)
ROUTE /serie
GET: '/:serieId' => checkAuth, getOneSerie
GET: '/' => checkAuth, getAllSeries
GET: '/categoryId/:categoryId' => checkAuth, getSeriesByCategory
POST: '/' => checkAuth, isAdmin, createSerie
PATCH: '/:serieId' => checkAuth, updateSerie➡️ 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)
ROUTE /favorite
GET: '/:userId' => checkAuth, getFavorites
POST: '/:userId/serie/:serieId' => checkAuth, addFavorite
DELETE: '/:userId/serie/:serieId' => checkAuth, deleteFavorite➡️ 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)
ROUTE /rating
GET: '/:serieId' => checkAuth, getRating
POST: '/:serieId' => checkAuth, createRating
PATCH: '/:ratingId' => checkAuth, updateRating
DELETE: '/:ratingId' => checkAuth, deleteRating➡️ User can create a serie's rating
➡️ User can get one rating
➡️ User can update rating
➡️ User can delete rating

