function removeBot(req, res) { logger.winston.info('Bot.updateBot'); db.run('delete from bots where bot_id = ?', req.params.bot_id, function(err) { if (err) { logger.winston.error("Error removing the record"); } else { res.status(200).json({ status: 'success', message: 'Removed' }); } }); }
function updateStory(conversation_id, story) { db.run('update conversations set story = ? where conversation_id = ?', [story, conversation_id], function (err) { if (err) { logger.winston.info("Error updating the record"); } else { logger.winston.info("Updated story"); } }); }
function setDBSchemaVersion(error) { if (error) { db.run("UPDATE version set version = ?", global.db_schema); logger.winston.info("Database Schema updated to v" + global.db_schema + " "); } else { db.run("INSERT into version (version) values (?)", global.db_schema); logger.winston.info("Database Schema v" + global.db_schema + " created"); } }
function createExpressionParameter(req, res, next) { logger.winston.info('parameters.createExpressionParameter'); db.run('insert into expression_parameters(expression_id, parameter_start, parameter_end, parameter_value, intent_id)' + 'values (?,?,?,?,?)', [req.body.expression_id, req.body.parameter_start, req.body.parameter_end, req.body.parameter_value, req.body.intent_id], function(err) { if (err) { logger.winston.error("Error inserting a new record"); } else { res.status(200).json({ status: 'success', message: 'Inserted' }); } }); }
function updateEntity(req, res, next) { logger.winston.info('entities.updateEntity'); db.run('update entities set entity_name = ?, slot_data_type = ? where entity_id = ?', [req.body.entity_name, req.body.slot_data_type, req.params.entity_id], function(err) { if (err) { logger.winston.error("Error updating the record"); } else { res.status(200).json({ status: 'success', message: 'Updated' }); } }); }
function updateBot(req, res, next) { logger.winston.info('Bot.updateBot'); db.run('update bots set bot_name = ?, output_folder = ?, bot_config = ? where bot_id = ?', [req.body.bot_name, req.body.output_folder, req.body.bot_config, req.body.bot_id], function(err) { if (err) { logger.winston.error("Error updating the record"); } else { res.status(200).json({ status: 'success', message: 'Updated' }); } }); }
function createAction(req, res, next) { logger.winston.info('actions.createAction'); db.run('insert into actions (action_name, bot_id)' + 'values (?,?)', [req.body.action_name, req.body.bot_id], function(err) { if (err) { logger.winston.error("Error inserting a new record"); } else { res.status(200).json({ status: 'success', message: 'Inserted' }); } }); }
function updateResponse(req, res, next) { logger.winston.info('responses.updateResponse'); db.run('update responses set response_text = ?, response_type = ? where response_id = ?', [req.body.response_text, req.body.response_type, req.body.response_id], function(err) { if (err) { logger.winston.error("Error updating the record"); } else { res.status(200).json({ status: 'success', message: 'Updated' }); } }); }
function removeVariant(req, res, next) { logger.winston.info('variants.removeVariant'); db.run('delete from synonym_variants where synonym_variant_id = ?', req.params.synonym_variant_id, function(err) { if (err) { logger.winston.error("Error removing the record"); } else { res.status(200).json({ status: 'success', message: 'Removed' }); } }); }
function updateStory(req, res, next) { logger.winston.info('Stories.updateStory'); db.run('update stories set story = ? where story_id = ?', [req.body.story, req.body.story_id], function(err) { if (err) { logger.winston.error("Error updating the record"); } else { res.status(200).json({ status: 'success', message: 'Updated' }); } }); }
function updateRegex(req, res, next) { logger.winston.info('regex.updateRegex'); db.run('update regex set regex_name = ?, regex_pattern = ? where regex_id = ?', [req.body.regex_name, req.body.regex_pattern, req.body.regex_id], function(err) { if (err) { logger.winston.error("Error updating the record"); } else { res.status(200).json({ status: 'success', message: 'Updated' }); } }); }
function createBot(req, res, next) { logger.winston.info('Bot.createBot'); db.run('insert into bots(bot_name, bot_config, output_folder)' + 'values (?,?,?)', [req.body.bot_name, req.body.bot_config, req.body.output_folder], function(err) { if (err) { logger.winston.error("Error inserting a new record"); } else { res.status(200).json({ status: 'success', message: 'Inserted' }); } }); }
function removeIntent(req, res, next) { //Remove all sub components of intent logger.winston.info('intents.removeIntent'); db.run('delete from intents where intent_id = ?', req.params.intent_id, function(err) { if (err) { logger.winston.error("Error removing the record"); } else { res.status(200).json({ status: 'success', message: 'Removed' }); } }); }
function createConversation(req, res, next) { logger.winston.info('Conversations.createConversation'); db.run('insert into conversations(bot_id)' + 'values (?)', [req.body.bot_id], function(err) { if (err) { logger.winston.error("Error inserting a new record"); } else { res.status(200).json({ status: 'success', message: 'Inserted' }); } }); }
function removeRegex(req, res, next) { logger.winston.info('regex.removeRegex'); db.run('delete from regex where regex_id = ?', req.params.regex_id, function(err) { if (err) { logger.winston.error("Error removing the record"); } else { res.status(200).json({ status: 'success', message: 'Removed' }); } }); }