Fix migrations for manual override
This commit is contained in:
parent
bb26c0f458
commit
9877fc8ef0
4 changed files with 332 additions and 98 deletions
|
|
@ -197,7 +197,7 @@ app.patch('/api/customer/:id', (req, res, next) => {
|
||||||
if (!req.query.authorizedOverride) return res.status(400).send({Error: 'Requires authorized'})
|
if (!req.query.authorizedOverride) return res.status(400).send({Error: 'Requires authorized'})
|
||||||
|
|
||||||
return customers.patch(req.params.id, {
|
return customers.patch(req.params.id, {
|
||||||
authorized_override: req.query.authorizedOverride
|
authorizedOverride: req.query.authorizedOverride
|
||||||
})
|
})
|
||||||
.then(r => res.send(r))
|
.then(r => res.send(r))
|
||||||
.catch(() => res.status(404).send({Error: 'Not found'}))
|
.catch(() => res.status(404).send({Error: 'Not found'}))
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ function get (phone) {
|
||||||
*/
|
*/
|
||||||
function patch (id, values) {
|
function patch (id, values) {
|
||||||
const sql = 'update customers set authorized_override=$2 where id=$1 returning *'
|
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) {
|
function getById (id) {
|
||||||
|
|
@ -84,7 +84,6 @@ function format (customer) {
|
||||||
value: customer.id_card_image_at
|
value: customer.id_card_image_at
|
||||||
}])
|
}])
|
||||||
customer.status = status.label
|
customer.status = status.label
|
||||||
|
|
||||||
return camelize(customer)
|
return camelize(customer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,9 +101,7 @@ function batch () {
|
||||||
where id != $1
|
where id != $1
|
||||||
order by created desc limit $2`
|
order by created desc limit $2`
|
||||||
return db.any(sql, [ anonymous.uuid, NUM_RESULTS ])
|
return db.any(sql, [ anonymous.uuid, NUM_RESULTS ])
|
||||||
.then(customers => {
|
.then(_.map(format))
|
||||||
return _.map(customer => format(customer), customers)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { add, get, batch, getById, patch}
|
module.exports = { add, get, batch, getById, patch}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ exports.up = function (next) {
|
||||||
*/
|
*/
|
||||||
`create type compliance_type as enum
|
`create type compliance_type as enum
|
||||||
('authorized', 'sms', 'id_card_data', 'id_card_photo', 'sanctions', 'cross_ref', 'front_camera', 'hard_limit')`,
|
('authorized', 'sms', 'id_card_data', 'id_card_photo', 'sanctions', 'cross_ref', 'front_camera', 'hard_limit')`,
|
||||||
'alter table compliance_authorizations alter column compliance_type type compliance_type using compliance_type::compliance_type',
|
'alter table compliance_authorizations alter column compliance_type set data type compliance_type using compliance_type::text::compliance_type',
|
||||||
'drop type compliance_types',
|
'drop type compliance_types',
|
||||||
|
|
||||||
"create type verification_type as enum ('verified', 'blocked', 'automatic')",
|
"create type verification_type as enum ('verified', 'blocked', 'automatic')",
|
||||||
|
|
|
||||||
319
public/elm.js
319
public/elm.js
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue