You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
606 B
24 lines
606 B
2 years ago
|
'use strict';
|
||
|
|
||
|
// 新增数据源
|
||
|
function addDataSource(opts) {
|
||
|
return async function (ctx, next) {
|
||
|
|
||
|
const models = ctx.fs.dc.models;
|
||
|
try {
|
||
|
let rslt = ctx.request.body;
|
||
|
await models.DataSource.create(Object.assign({}, rslt))
|
||
|
ctx.status = 204;
|
||
|
ctx.body = { message: '新建数据源成功' }
|
||
|
} catch (error) {
|
||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
|
||
|
ctx.status = 400;
|
||
|
ctx.body = { message: '新建数据源失败' }
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = {
|
||
|
addDataSource,
|
||
|
}
|