Added type input to the sendRequest function.
This commit is contained in:
@@ -67,13 +67,16 @@ class RequestRepository {
|
||||
});
|
||||
}
|
||||
|
||||
sendRequest(identifier) {
|
||||
/**
|
||||
* Send request for given media id.
|
||||
* @param {identifier, type} the id of the media object and type of media must be defined
|
||||
* @returns {Promise} If nothing has gone wrong.
|
||||
*/
|
||||
sendRequest(identifier, type) {
|
||||
// TODO add to DB so can have a admin page
|
||||
// TODO try a cache hit on the movie item
|
||||
|
||||
tmdb.lookup(identifier).then(movie => {
|
||||
console.log(movie.title)
|
||||
|
||||
tmdb.lookup(identifier, type).then(movie => {
|
||||
|
||||
// create reusable transporter object using the default SMTP transport
|
||||
let transporter = nodemailer.createTransport({
|
||||
@@ -110,6 +113,7 @@ class RequestRepository {
|
||||
|
||||
})
|
||||
|
||||
// TODO add better response when done.
|
||||
return Promise.resolve();
|
||||
|
||||
}
|
||||
|
||||
@@ -11,8 +11,9 @@ const requestRepository = new RequestRepository();
|
||||
function submitRequestController(req, res) {
|
||||
// This is the id that is the param of the url
|
||||
const id = req.params.mediaId;
|
||||
const type = req.query.type;
|
||||
|
||||
requestRepository.sendRequest(id)
|
||||
requestRepository.sendRequest(id, type)
|
||||
.then(() => {
|
||||
res.send({ success: true, message: 'Media item sucessfully requested!' });
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user