From 61bd6862aa72dd48347cdf68ffaec68f2dff2018 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Mon, 8 Jan 2018 13:49:24 +0100 Subject: [PATCH] removed unnecessary function --- backend/express.js | 84 ---------------------------------------------- 1 file changed, 84 deletions(-) diff --git a/backend/express.js b/backend/express.js index d878244..c951813 100644 --- a/backend/express.js +++ b/backend/express.js @@ -37,22 +37,6 @@ alexaApp.express({ preRequest: (request, response)=>{ console.log('Pre req'); - /* - const alexaRequest = new alexa.request(request); - if (alexaRequest.type() === "IntentRequest") { - db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,skill)=>{ - if (skill) { - console.log(alexaRequest.data.request.intent); - let intentId = findElementByAttr(skill.intents, 'intentName', alexaRequest.data.request.intent.name); - const response = new alexa.response(alexaRequest.getSession()); - if (intentId !== -1){ - return response.say(skill.intents[intentId].answer); - }else{ - return response.say('Sorry, I could not find desired intent'); - } - } - }); - }*/ } }); @@ -61,56 +45,6 @@ alexaApp.express({ // from here on you can setup any other express routes or middlewares as nor app.set("view engine", "ejs"); -/* -alexaApp.launch(function(request, response) { - console.log("Alexa launch"); - db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,skill)=>{ - if (skill){ - console.log('pass'); - return new Promise ((resolve,reject)=>{ - }else{ - console.log('error'); - } - /* - if (err){ - return response.say("I could not find desired skill") - console.log('error ' + err); - }else{ - //return response.say(result.invocationAnswer); - return response.say('Welcome'); - console.log('Poslano'); - } - }); -});*/ - -var findElementByAttr = function (data, attr, val){ - for(var i = 0; i < data.length; i ++) { - if(data[i][attr] === val) { - return i; - } - } - return -1; -} - -/* -alexaApp.request = (jsonRequest) => { - const alexaRequest = new alexa.request(jsonRequest); - if (alexaRequest.type() === "IntentRequest") { - db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err,skill)=>{ - if (skill) { - console.log(alexaRequest.data.request.intent); - let intentId = findElementByAttr(skill.intents, 'intentName', alexaRequest.data.request.intent.name); - const response = new alexa.response(alexaRequest.getSession()); - if (intentId !== -1){ - response.say(skill.intents[intentId].answer); - }else{ - response.say('Sorry, I could not find desired intent'); - } - } - }); - } -}; -*/ var updateIntentsJSON = function(){ db.collection('skill_list').findOne({_id: ObjectID(skillDbID)}, (err, skill)=>{ @@ -125,24 +59,6 @@ var updateIntentsJSON = function(){ }); } - -/* -alexaApp.intent("SimpleIntent", { - "slots": [], - "utterances": ["Tell me somethin"] - }, - function(request, response) { - response.say("This is sample"); - } -); -*/ - -/* -alexaApp.error = function(exception, request, response){ - console.log('Error ' + exception); - response.say('Sorry, there was error in Saburly skill'); // TODO : Rephrase this -};*/ - router.get ('/getSkill/:id', async (req, res, next) => { try { const id = req.params.id;