Customers table: exclude anonymous from batch
This commit is contained in:
parent
f8f7f87cca
commit
69ae1401a3
3 changed files with 4359 additions and 88 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
const anonymousCustomer = {
|
const anonymousCustomer = {
|
||||||
uuid : '47ac1184-8102-11e7-9079-8f13a7117867',
|
uuid: '47ac1184-8102-11e7-9079-8f13a7117867',
|
||||||
name: 'anonymous',
|
name: 'anonymous'
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {anonymousCustomer}
|
module.exports = {anonymousCustomer}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ const db = require('./db')
|
||||||
const uuid = require('uuid')
|
const uuid = require('uuid')
|
||||||
const _ = require('lodash/fp')
|
const _ = require('lodash/fp')
|
||||||
const BN = require('./bn')
|
const BN = require('./bn')
|
||||||
|
const anonymous = require('../lib/constants').anonymousCustomer
|
||||||
|
|
||||||
function add (customer) {
|
function add (customer) {
|
||||||
const sql = 'insert into customers (id, phone, phone_at) values ($1, $2, now()) returning *'
|
const sql = 'insert into customers (id, phone, phone_at) values ($1, $2, now()) returning *'
|
||||||
|
|
@ -33,8 +34,8 @@ function getDailyVolume (id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function batch () {
|
function batch () {
|
||||||
const sql = 'select * from customers'
|
const sql = `select * from customers where id not in ($1)`
|
||||||
return db.any(sql)
|
return db.any(sql, [anonymous.uuid])
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { add, get, batch }
|
module.exports = { add, get, batch }
|
||||||
|
|
|
||||||
4438
public/elm.js
4438
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