Good, so I'm working on a personal project with which you can “browse” the lists. The user can find the movie they heard using the public API (TheMovieDB) and add it to their watchlist. Whenever a movie is added, I save the data in a database. I use the following tables (excluding columns that are not relevant to the question):
of users
movies
movies_users
- ID (PK)
- movie_ID (FK link identifier in the movie table)
- user_ID (identifier of FK links in the user table)
genres
genres_movies
- ID (PK)
- genre_ID (FK link identifier in the genre table)
- movie_ID (FK link identifier in the movie table)
MariaDB, ON DUPLICATE KEY UPDATE, , , , - , movies_users. , .
NodeJS BookshelfJS.
SQL, , . , Promises. , : http://codeshare.io/BPWDV.
, ? knex.raw(http://knexjs.org/#Raw-Queries), ON DUPLICATE KEY UPDATE. , :
- ,
- , , movies_users. , , .
- movies_users
- . , , , . , , .
- , genres_movies
, , . promises . , , ?
act_movies, , ( Promise.map).
, , : , , , , ?