Skip to content

xiaohangsu/movieHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MovieHub

MovieHub backend inhert from repo/webBootstrap

package

  • koa2
  • sequelize (mysql)

Restful API

System

Currently without Session Auth

post /login

req example:

{
  "cusname": name,
  "cuspassword": password
}

res:

  • 200 Success
  • 201 Failed
  • 400 Error

post /register

req example:

{
  "cusname": name,
  "cusemail": email,
  "cuspassword": password,
  "cusPortraitUrl": url
}

res:

  • 200 Success
  • 400 Error

Customer

post /db/addCustomer

req example:

{
  "cusname": name,
  "cusemail": email,
  "cuspassword": password,
  "cusPortraitUrl": url
}

res:

  • 200 Success
  • 400 Error

post /db/updateCustomerPassword

req example:

{
  "cusname": name,
  "cuspassword": password,
}

res:

  • 200 Success
  • 205 Unmatched or Same Password
  • 400 Error
message

post /db/updateCustomerPortraitUrl

req example:

{
  "cusname": name
}

res:

  • 200 Success
  • 205 Unmatched
  • 400 Error
message

post /db/deleteCustomer

req example:

{
  "cusname": name
  "cusPortraitUrl": url
}

res:

  • 200 Success
  • 205 Unmatched
  • 400 Error
message

post /db/getUserRatings

Return all user ratings via cusid.

req example:

{
	"cusid": User Id(MUST)
}

res:

  • 200 Success
  • 400 Error
instances

Movie

post /db/addMovie

req example:

{
  "movid": movid,
  "movname": movie name,
  "movyear": movie year(INT),
  "genre": genre,
 "director": director,
 "description": description,
 "movTrailerUrl": movTrailerUrl
 "movScreenshotUrl": movScreenshotUrl
}

res:

  • 200 Success
  • 400 Error
message

post /db/findMovie

req example:

{
  "movid": movid,
}

res:

  • 200 Success
  • 205 Unmatched or Same Password
  • 400 Error
message

post /db/deleteMovie

req example:

{
  "movid": movid
}

res:

  • 200 Success
  • 205 Unmatched
  • 400 Error
message

post /db/updateMovie

req example:

{
  "movid": movid (MUST)
 "movname": movie name (OPTIONAL),
  "movyear": movie year (OPTIONAL),
  "
}

res:

  • 200 Success
  • 205 Unmatched
  • 400 Error
message

get /db/movieGenres

Return all Movie Genres

res:

  • 200 Success
  • 205 Unmatched
  • 400 Error
message

post /db/getMoviesByGenre

Return data orders by movid.
Trick: When first time to fetch, movid=-1 can get movid > -1 rows. Then you can get every count number of rows by passing last movid
Return not more than count number of rows data.

req example:

{
  "movid": movid (MUST),
  "genre": genre (MUST),
	"count": count(MUST)
}

res:

  • 200 Success
  • 400 Error
instances

post /db/getNewestMovies

Return most recently count numbers movie by movyear.

req example:

{
	"count": count(MUST)
}

res:

  • 200 Success
  • 400 Error
instances

post /searchMovies

Return data orders by movid.
Trick: When first time to fetch, movid=-1 can get movid > -1 rows. Then you can get every count number of rows by passing last movid
Return not more than count number of rows data.

req example:

{
  "movid": movid (MUST),
  "movname": movname (MUST or Partial Name),
	"count": count(MUST)
}

res:

  • 200 Success
  • 400 Error
instances

Rating

post /db/addRating

req example:

{
	"movid": movie id(MUST),
	"cusid": customer id(MUST),
  "rating": rating (MUST, INT 0 - 10)
}

res:

  • 200 Success
  • 400 Error
message

post /db/deleteRating

req example:

{
	"movid": movie id(MUST),
	"cusid": customer id(MUST)
}

res:

  • 200 Success
  • 205 Unmatched
  • 400 Error
message

post /db/updateRating

req example:

{
	"movid": movie id(MUST),
	"cusid": customer id(MUST),
	"rating": rating(MUST, INT 0-10)
}

res:

  • 200 Success
  • 205 Unmatched Or still same rating
  • 400 Error
message

post /db/groupRatingByMovie

Return all ratings of a movie using Group By.
You can use this to get 0-10 rating total and calculate average rating.

req example:

{
	"movid": movie id(MUST),
	"rating": rating(MUST, INT 0-10)
}

res:

  • 200 Success
  • 400 Error
instances

post /db/getRecommendMovies

Return recommend movies according userId.

req example:

{
	"userId": User Id(MUST)
}

res:

  • 200 Success
  • 400 Error
instances

About

MovieHub backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published