Giter Site home page Giter Site logo

moviehub's Introduction

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

moviehub's People

Contributors

xiaohangsu avatar

Stargazers

Tingjun Zhang avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.