using cuestionario2 has atribute, create credentials for testing

This commit is contained in:
Your Name
2025-02-13 13:57:28 -05:00
parent f89b7e05db
commit 7bef28e60f
22 changed files with 251 additions and 39 deletions
+26 -1
View File
@@ -10,15 +10,34 @@ const { google } = require('googleapis');
// ['https://www.googleapis.com/auth/drive']
// );
const loadCredentials = () => {
/* const loadCredentials = () => {
try {
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
return google.auth.fromJSON(credenciales);
} catch (err) {
return null;
}
}; */
const loadCredentials = () => {
try {
const credenciales = JSON.parse(fs.readFileSync('./cred.json', 'utf8'));
credenciales.private_key = credenciales.private_key.replace(/\\n/g, '\n'); // Asegurar formato correcto
return new google.auth.JWT(
credenciales.client_email,
null,
credenciales.private_key,
['https://www.googleapis.com/auth/drive']
);
} catch (err) {
console.error('❌ Error cargando credenciales:', err);
return null;
}
};
const list = (pageToken) => {
return new Promise(async (resolve, reject) => {
// jwtClient.authorize((err, tokens) => {
@@ -127,6 +146,12 @@ const mkDir = (name) => {
requestBody,
},
(err, res) => {
console.log(err);
console.log("variable res ");
console.log(res);
if (err) reject(err);
resolve(res.data.id);
}
+3 -3
View File
@@ -6,16 +6,16 @@ const send = require('gmail-send')({
});
const gmail = (subject, to, text) => {
/*
return new Promise((resolve, reject) => {
send({ subject, to, text }, (error, result, fullResult) => {
if (error) reject(error);
resolve(result);
});
});
*/
return "envio de correo"
// return "envio de correo"
};
+10 -4
View File
@@ -178,15 +178,21 @@ const validarPreTermino = (idServicio) => {
// validar el if
console.log("este es el id en la busqieda", idServicio);
return Servicio.findOne({ where: { idServicio } })
.then((res) => {
console.log("validando pre termino", res);
if (
res.idCuestionarioPrograma &&
res.idCuestionarioAlumno &&
(res.idCuestionarioPrograma || res.idCuestionarioPrograma2) &&
(res.idCuestionarioAlumno || res.idCuestionarioAlumno2) &&
res.cartaTermino &&
res.informeGlobal
)
return Servicio.update({ idStatus: 5 }, { where: { idServicio } });
) return Servicio.update({ idStatus: 5 }, { where: { idServicio } });
return false;
})
.then((res) =>