Skip to content

Commit

Permalink
Adds timeStamp to data if not present (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrrrzzt committed Sep 22, 2019
1 parent fc40a4c commit 1b2b78a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/handle-logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module.exports = async query => {
if (query.action === 'add') {
logger('info', ['handle-logs', 'action', 'add'])
const data = query.data
data.isQueued = Object.prototype.hasOwnProperty.call(query.data, 'isQueued') ? query.data.isQueued : true
const { isQueued, timeStamp } = data
data.isQueued = isQueued || true
data.timeStamp = timeStamp || new Date().getTime()
try {
const result = await logs.insertOne(data)
logger('info', ['handle-logs', 'action', 'add', 'success'])
Expand Down

0 comments on commit 1b2b78a

Please sign in to comment.