Fix migrations for manual override

This commit is contained in:
goga-m 2017-09-27 12:10:48 +03:00 committed by Josh Harvey
parent bb26c0f458
commit 9877fc8ef0
4 changed files with 332 additions and 98 deletions

View file

@ -32,7 +32,7 @@ function get (phone) {
*/
function patch (id, values) {
const sql = 'update customers set authorized_override=$2 where id=$1 returning *'
return db.oneOrNone(sql, [id, values.authorized_override])
return db.oneOrNone(sql, [id, values.authorizedOverride])
}
function getById (id) {
@ -84,7 +84,6 @@ function format (customer) {
value: customer.id_card_image_at
}])
customer.status = status.label
return camelize(customer)
}
@ -102,9 +101,7 @@ function batch () {
where id != $1
order by created desc limit $2`
return db.any(sql, [ anonymous.uuid, NUM_RESULTS ])
.then(customers => {
return _.map(customer => format(customer), customers)
})
.then(_.map(format))
}
module.exports = { add, get, batch, getById, patch}