2024-02-29 13:15:31 +00:00
|
|
|
import {sqliteConnection as con} from "../../index";
|
|
|
|
|
2018-12-16 03:49:59 +00:00
|
|
|
interface epsRespuesta {
|
|
|
|
ep_ID: number,
|
|
|
|
opcion_ID: number,
|
|
|
|
num_ep: number,
|
|
|
|
visitas: number,
|
|
|
|
link: string,
|
|
|
|
peso: string
|
|
|
|
}
|
|
|
|
|
2024-02-29 13:15:31 +00:00
|
|
|
export const obtenerLinks = (req: any, res: any) => {
|
2018-12-16 03:49:59 +00:00
|
|
|
|
|
|
|
const YAML = require('yaml');
|
|
|
|
|
|
|
|
const opcion_ID = req.params.opcion_ID;
|
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
if (opcion_ID) {
|
|
|
|
|
|
|
|
const query = `SELECT * FROM eps WHERE opcion_ID=${opcion_ID}`;
|
2024-02-29 13:15:31 +00:00
|
|
|
con.query(query, (err, response: epsRespuesta[]) => {
|
2018-12-21 00:13:51 +00:00
|
|
|
if (!err) {
|
|
|
|
|
|
|
|
res.send(YAML.stringify(response));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
console.log("Error al ejecutar query en /Admin/Eps/obtenerEps con.query (linea 21). Query:\n" + query + "\nError: \n" + err);
|
|
|
|
res.send("error: true");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
console.log("Error. opcion_ID no existe en /Admin/Eps/obtenerEps con.connect (linea 8)");
|
|
|
|
res.send("error: true");
|
|
|
|
}
|
2018-12-16 03:49:59 +00:00
|
|
|
|
|
|
|
};
|