2018-12-20 21:30:16 +00:00
|
|
|
interface RespuestaED {
|
|
|
|
ED_ID: number,
|
|
|
|
anime_ID: number,
|
|
|
|
num_ED: number,
|
|
|
|
nombre: string,
|
|
|
|
artista: string,
|
|
|
|
eps: string
|
|
|
|
}
|
|
|
|
|
|
|
|
const obtenerEDs = (req: any, res: any) => {
|
|
|
|
|
|
|
|
const YAML = require('yaml');
|
|
|
|
const anime_ID: number = req.params.anime_ID;
|
2018-12-21 00:13:51 +00:00
|
|
|
const con = require('../../index').conexionMySQL;
|
2018-12-20 21:30:16 +00:00
|
|
|
|
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
if (anime_ID) {
|
2018-12-20 21:30:16 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
const query = `SELECT * FROM ED WHERE anime_ID=${anime_ID}`;
|
|
|
|
con.query(query, (err: Error, response: RespuestaED[]) => {
|
|
|
|
if (!err) {
|
2018-12-20 21:30:16 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
res.send(YAML.stringify(response));
|
2018-12-20 21:30:16 +00:00
|
|
|
|
2018-12-21 00:13:51 +00:00
|
|
|
} else {
|
|
|
|
res.send("error: true");
|
|
|
|
console.log("Error al ejecutar query en /Admin/ED/nuevoED (con.query):\n" + query + "\n" + err);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
res.send("error: true");
|
|
|
|
console.log("Error en /Admin/ED/obtenerEDs: anime_ID no existe.");
|
|
|
|
}
|
2018-12-20 21:30:16 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.obtenerEDs = obtenerEDs;
|