oneday-core
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -21,2 +21,7 @@ | ||
module.exports.resource_type = { | ||
CHANNEL: 'channel', | ||
MEDIA: 'media' | ||
}; | ||
module.exports.channel_status = { | ||
@@ -23,0 +28,0 @@ DRAFT: 'draft', |
32
index.js
@@ -35,7 +35,7 @@ 'use strict'; | ||
}; | ||
postToDb(params).then( | ||
(status) => { | ||
dynamoDb.put(params).promise().then( | ||
(result) => { | ||
console.log("Successfully saved to EventLog table. "); | ||
}, | ||
(status, error) => { | ||
(error) => { | ||
console.log("Error when saving to EventLog table: " + error); | ||
@@ -45,3 +45,3 @@ }); | ||
function saveError(error, data, type) { // Saves the given error to the error table | ||
function saveError(message, error, data, type) { // Saves the given error to the error table | ||
console.error(error); | ||
@@ -54,10 +54,11 @@ const params = { | ||
data: JSON.stringify(data), | ||
error: error | ||
error: error, | ||
message: message | ||
} | ||
}; | ||
postToDb(params).then( | ||
(status) => { | ||
dynamoDb.put(params).promise().then( | ||
(result) => { | ||
console.log("Successfully saved to Error table. "); | ||
}, | ||
(status, error) => { | ||
(error) => { | ||
console.log("Error when saving to Error table: " + error); | ||
@@ -67,16 +68,2 @@ }); | ||
async function postToDb(params) { // Saves given params to db | ||
try { | ||
await dynamoDb.put(params).promise(); | ||
return { | ||
status: true | ||
}; | ||
} catch (error) { | ||
return { | ||
status: false, | ||
error: "Could not post to db: " + error.stack | ||
}; | ||
} | ||
} | ||
function sendToQueue(body, queueName) { // Sends a message to the given queue | ||
@@ -177,3 +164,2 @@ | ||
module.exports.isObject = isObject; | ||
module.exports.postToDb = postToDb; | ||
module.exports.saveEvent = saveEvent; | ||
@@ -180,0 +166,0 @@ module.exports.saveError = saveError; |
{ | ||
"name": "oneday-core", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Basic AWS util functions to ease development.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
11400
302