2018-12-13 01:10:51 +00:00
|
|
|
const obtenerOPs = (req: any, res: any) => {
|
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
const con = require('../../index').conexionMySQL;
|
2018-12-13 01:10:51 +00:00
|
|
|
const YAML = require('yaml');
|
|
|
|
|
2018-12-20 21:30:16 +00:00
|
|
|
const animeID: number = req.params.id;
|
2018-12-13 01:10:51 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
if (animeID) {
|
2018-12-13 01:10:51 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
const query = `SELECT * FROM OP WHERE anime_ID=${animeID}`;
|
|
|
|
con.query( query, (err: any, resultado: object) => {
|
|
|
|
if (!err) {
|
2018-12-13 01:10:51 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
res.send(YAML.stringify(resultado));
|
2018-12-13 01:10:51 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
} else {
|
|
|
|
console.log("Error al ejecutar query en /Admin/OP/obtenerOPs (con.query):\n" + query + "\n" + err);
|
|
|
|
res.send("error: true");
|
|
|
|
}
|
|
|
|
});
|
2018-12-13 01:10:51 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
} else {
|
|
|
|
console.log("Error en /Admin/OP/obtenerOPs: animeID no existe");
|
|
|
|
res.send("error: true");
|
|
|
|
}
|
2018-12-13 01:10:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.obtenerOPs = obtenerOPs;
|