Files
dvcp-node-service/rest/autodeploy/list.js
2022-03-30 19:19:56 +08:00

29 lines
618 B
JavaScript

const dbUtils = require("../../utils/dbUitls");
module.exports = {
action: "/node/autodeploy/list",
method: "post",
execute: (request, response) => {
let total = 0, records = []
Promise.all([
dbUtils.query(`select 1 from node_autodeploy`).then(res => {
return total = res.length
}),
new Promise(resolve => {
let sql = `select * from node_autodeploy`
dbUtils.query(sql).then(res => {
records = res
resolve()
})
})
]).then(() => {
response.send({
code: 0,
data: {records, total}
})
})
}
}