i am trying to get roles from user, but got empty object instead
export async function resetPassword(req, res) {
const { id } = req.user;
try {
const loggedInUser = await User.where('id', id).fetch({withRelated: ['roles']});
if (!loggedInUser) {
return res.status(HttpStatus.NOT_FOUND).json({
message: 'User not found',
});
}
const usersRoles = loggedInUser.roles;
return res.json({
test: usersRoles
});
} catch (err) {
Logger.error(err.message);
return res.status(HttpStatus.INTERNAL_SERVER_ERROR).json({
message: err.message,
});
}
}
this is the user object
how to access the roles data, please help?

