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]; }