32 lines
790 B
TypeScript
32 lines
790 B
TypeScript
const nuevoOP = (req: any, res: any) => {
|
|
|
|
const con = require('../../mysql').obtenerConexionMySql();
|
|
const YAML = require('yaml');
|
|
|
|
const data = YAML.parse(req.body.data);
|
|
|
|
con.connect((err: any) => {
|
|
if (!err) {
|
|
|
|
con.query(
|
|
`INSERT INTO OP (anime_ID, num_OP, nombre, artista, eps) VALUES \
|
|
(${con.escape(data['anime_ID'])}, ${con.escape(data['num_OP'])}, ${con.escape(data['nombre'])}, ${con.escape(data['artista'])}, ${con.escape(data['eps'])})`,
|
|
(err: any) => {
|
|
if (!err) {
|
|
|
|
res.send("Exito :D");
|
|
|
|
} else {
|
|
|
|
}
|
|
}
|
|
);
|
|
|
|
} else {
|
|
|
|
}
|
|
});
|
|
|
|
};
|
|
|
|
module.exports.nuevoOP = nuevoOP; |