fix list user error

master
tungd0 2 years ago
parent 76b231804e
commit 728c7eed23
  1. 44
      src/api/controllers/v1/user.controller.js

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

Loading…
Cancel
Save