
const getCtr = (req, res) => {
    let _resp_json = {
        result: "ok",
        reason: {
            content: "",
            body: "",
        },
        req_body: {},
        req_param: {}
    }
    //
    let { id } = req.query;
    let ret_id = _GTP.STR_VALIDER(id);
    if (!ret_id) {
        _resp_json.result = "fail";
        _resp_json.reason = "Body 'id' Error";
        res.status(400).json(_resp_json);
        return;
    }
    _SPM.db.pgSql.Query_AUTH_GET(id)
    .then((resRow) => {
        if (!resRow.rows.length) throw new Error("account is Empty")

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

module.exports = getCtr;