|
|
@ -43,17 +43,33 @@ 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",
|
|
|
|
|
|
|
|
// is_active: true
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// ).then(result => {
|
|
|
|
|
|
|
|
// res.json({
|
|
|
|
|
|
|
|
// code: 0,
|
|
|
|
|
|
|
|
// count: req.totalRecords,
|
|
|
|
|
|
|
|
// data: result.map(
|
|
|
|
|
|
|
|
// x => User.transform(x)
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }).catch(ex => {
|
|
|
|
|
|
|
|
// ErrorHandler(ex, req, res, next);
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return User.findAll({ |
|
|
|
|
|
|
|
where : { |
|
|
|
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 |
|
|
|
x => User.transform(x) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}).catch(ex => { |
|
|
|
}).catch(ex => { |
|
|
|
ErrorHandler(ex, req, res, next); |
|
|
|
ErrorHandler(ex, req, res, next); |
|
|
|