You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
451 B
JavaScript
19 lines
451 B
JavaScript
5 years ago
|
const pg = require('../pg')
|
||
|
const joinjs = require('join-js').default;
|
||
|
const debug = require('debug')('sos:db:order')
|
||
|
const mappings = require('../mappings')
|
||
|
|
||
|
const order = module.exports = {}
|
||
|
|
||
|
order.create = async function(cart_uuid){
|
||
|
const query = {
|
||
|
text: 'select * from sos.create_order($1)',
|
||
|
values: [cart_uuid]
|
||
|
}
|
||
|
|
||
|
debug(query);
|
||
|
|
||
|
const {rows} = await pg.query(query)
|
||
|
return joinjs.map(rows, mappings, 'orderMap', 'order_')[0];
|
||
|
}
|