|
|
@ -43,21 +43,37 @@ exports.create = async (req, res, next) => { |
|
|
|
exports.list = async (req, res, next) => { |
|
|
|
exports.list = async (req, res, next) => { |
|
|
|
req.query.services = User.Services.USER; |
|
|
|
req.query.services = User.Services.USER; |
|
|
|
// console.log(req.query.services);
|
|
|
|
// console.log(req.query.services);
|
|
|
|
User.list( { |
|
|
|
// User.list( {
|
|
|
|
service : "user", |
|
|
|
// service : "user",
|
|
|
|
is_active: true |
|
|
|
// is_active: true
|
|
|
|
} |
|
|
|
// }
|
|
|
|
).then(result => { |
|
|
|
// ).then(result => {
|
|
|
|
res.json({ |
|
|
|
// res.json({
|
|
|
|
code: 0, |
|
|
|
// code: 0,
|
|
|
|
count: req.totalRecords, |
|
|
|
// count: req.totalRecords,
|
|
|
|
data: result.map( |
|
|
|
// data: result.map(
|
|
|
|
x => User.transform(x) |
|
|
|
// x => User.transform(x)
|
|
|
|
) |
|
|
|
// )
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }).catch(ex => {
|
|
|
|
|
|
|
|
// ErrorHandler(ex, req, res, next);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return User.findAll({ |
|
|
|
|
|
|
|
where : { |
|
|
|
|
|
|
|
service : "user", |
|
|
|
|
|
|
|
is_active: true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).then(result => { |
|
|
|
|
|
|
|
res.json({ |
|
|
|
|
|
|
|
code: 0, |
|
|
|
|
|
|
|
count: req.totalRecords, |
|
|
|
|
|
|
|
data: result |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}).catch(ex => { |
|
|
|
|
|
|
|
ErrorHandler(ex, req, res, next); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}).catch(ex => { |
|
|
|
|
|
|
|
ErrorHandler(ex, req, res, next); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|