Skip to content

Instantly share code, notes, and snippets.

@radzionc
Created November 5, 2019 03:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radzionc/1c30bbd1662cc3771b273d1f664c2dc9 to your computer and use it in GitHub Desktop.
Save radzionc/1c30bbd1662cc3771b273d1f664c2dc9 to your computer and use it in GitHub Desktop.
const { documentClient, setNewValue, mergedParams, searchByKeyParams, projectionExpression } = require('./utils/db')
const { TABLE_NAME } = require('./constants/db')
const defaultParams = id => ({
TableName: TABLE_NAME.USERS,
Key: { id }
})
const getByEmail = (email, attributes = undefined) =>
documentClient
.scan(
mergedParams(
{ TableName: TABLE_NAME.USERS },
searchByKeyParams('email', email),
projectionExpression(attributes)
)
)
.promise()
.then(data => data.Items[0])
const emails = []
const ignore = async () => {
await Promise.all(emails.map(async email => {
const { id } = await getByEmail(email, ['id'])
await setNewValue(defaultParams(id), 'ignorePomodoroNews', true)
}))
}
ignore()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment