const db = require('../config/db.config.js'); const User = db.user; const Role = db.role; /** * getUser */ exports.getUser = (req, res) => { User.findOne({ attributes: ['username', 'phonenumber','email'], where: {id: req.body.userId} , include: [{ model: Role, through:{ attributes:[] } }] }).then(user => { res.status(200).json({ "description": "User Data", "user": user }); }).catch(err => { res.status(500).json({ "description": "Can not access User Page", "error": err }); }) }