|
|
@ -2,6 +2,7 @@ const pg = require('../pg')
|
|
|
|
const joinjs = require('join-js').default;
|
|
|
|
const joinjs = require('join-js').default;
|
|
|
|
const debug = require('debug')('sos:db:category')
|
|
|
|
const debug = require('debug')('sos:db:category')
|
|
|
|
const mappings = require('../mappings')
|
|
|
|
const mappings = require('../mappings')
|
|
|
|
|
|
|
|
const dbUtil = require('../util')
|
|
|
|
|
|
|
|
|
|
|
|
const category = module.exports = {}
|
|
|
|
const category = module.exports = {}
|
|
|
|
|
|
|
|
|
|
|
@ -87,3 +88,15 @@ category.addCategory = async (parent_uuid, child_uuid) => {
|
|
|
|
return joinjs.map(rows, mappings, 'categoryMap', 'category_')[0];
|
|
|
|
return joinjs.map(rows, mappings, 'categoryMap', 'category_')[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
category.update = async (uuid, name, urlslug, description) =>
|
|
|
|
|
|
|
|
dbUtil.executeFunction({
|
|
|
|
|
|
|
|
name: 'update_category',
|
|
|
|
|
|
|
|
params: [
|
|
|
|
|
|
|
|
uuid,
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
urlslug,
|
|
|
|
|
|
|
|
description
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
returnType: 'category',
|
|
|
|
|
|
|
|
single: true
|
|
|
|
|
|
|
|
})
|
|
|
|