//GET
const rolesCtr = async (req, res) => {
    let _resp_json = {
        result: "ok",
        reason: "",
        data: {},
        req_body: {},
        req_param: {}
    }
    
    _SPM.db.pgSql.Query_AUTH_ROLES()
    .then((resRow) => {
        if (!resRow.rows.length) throw new Error("role is Empty")

        _resp_json.result = "ok";
        _resp_json.data = resRow.rows
        _resp_json.reason = 'get roles';
        res.status(200).json(_resp_json);
    })
    .catch((error)=>{
        console.log(error);
        _resp_json.result = "fail";
        _resp_json.reason = error.message;
        res.status(200).json(_resp_json);
    })
    
}

module.exports = rolesCtr;