Commit 3e8cac99 by Denys Tito Urbano

Login con cuenta de trismegisto, parametros de horario y materiales actualizados

parent 706e8601
PORT=
PORT=3000
SECRET_KEY=
SECRET_KEY=nYsIyLHmOQSZcQmQYxKoXLMYCszXcbJt
DRIVE_ACCOUNT=
DRIVE_ACCOUNT=materiales@sacooliveros.edu.pe
DB_POSTGRESQL_SIIAA_HOST=
DB_POSTGRESQL_SIIAA_PORT=
DB_POSTGRESQL_SIIAA_NAME=
DB_POSTGRESQL_SIIAA_USERNAME=
DB_POSTGRESQL_SIIAA_PASSWORD=
DB_POSTGRESQL_SIIAA_HOST=162.0.227.166
DB_POSTGRESQL_SIIAA_PORT=5434
DB_POSTGRESQL_SIIAA_NAME=db_sis_siiaa_mig
DB_POSTGRESQL_SIIAA_USERNAME=usr_soporte
DB_POSTGRESQL_SIIAA_PASSWORD=s@c00504+
URL_FACTURACION_ELECTRONICA_SIIAA=
URL_TRISMEGISTO_APIS=
\ No newline at end of file
URL_FACTURACION_ELECTRONICA_SIIAA=https://fichaonline.sacooliveros.edu.pe:8080/FacturacionElectronicaSIIAA/api/v1
URL_TRISMEGISTO_APIS=https://fichaonline.sacooliveros.edu.pe:8000/trismegisto-apis/api/v1
\ No newline at end of file
......@@ -3,8 +3,8 @@ const { error_json } = require('../helpers');
const get_horario = async (req, res) => {
try {
const { documento } = req.params;
const salida = await service.get_horario({ documento });
const { documento, aula_id } = req.query;
const salida = await service.get_horario({ documento, aula_id });
res.json(salida);
} catch (error) {
......
......@@ -3,8 +3,8 @@ const { error_json } = require('../helpers');
const get_materiales = async (req, res) => {
try {
const { aula_id, curso_id, profesor_id } = req.query;
const salida = await service.get_materiales({ aula_id, curso_id, profesor_id });
const { aula_id, curso_id } = req.query;
const salida = await service.get_materiales({ aula_id, curso_id });
res.json(salida);
} catch (error) {
......
const { encrypt } = require('../helpers/encrypt');
const connection = require('./config');
const post_login = async ({ email, password }) => {
if (password) {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login ( $1, $2 );', [email, password]);
const password_encrypt = encrypt(password);
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login_obtener ( $1, $2 );', [email, password_encrypt]);
} else {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login ( $1 );', [email]);
return await connection.oneOrNone('SELECT * FROM academico.func_tma_login_obtener ( $1 );', [email]);
}
};
const get_account = async ({ documento }) => {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_cuenta ( $1 );', [documento]);
return await connection.oneOrNone('SELECT * FROM academico.func_tma_cuenta_obtener ( $1 );', [documento]);
};
module.exports = {
......
const connection = require('./config');
const get_horario = async ({ documento }) => {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_horario_obtener ( $1 );', [documento]);
const get_horario = async ({ documento, aula_id }) => {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_horario_obtener ( $1, $2 );', [documento, aula_id]);
};
module.exports = {
......
const connection = require('./config');
const get_materiales = async ({ aula_id, curso_id, profesor_id }) => {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_material_listar ( $1, $2, $3 );', [aula_id, curso_id, profesor_id]);
return await connection.oneOrNone('SELECT * FROM academico.func_tma_material_listar ( $1, $2 );', [aula_id, curso_id]);
};
module.exports = {
......
const md5 = require('md5');
const shajs = require('sha.js')
console.log(md5('maxi') + shajs('sha384').update('rcortez').digest('hex') + shajs('sha256').update('neti').digest('hex'));
\ No newline at end of file
const md5 = require('md5');
const shajs = require('sha.js')
const encrypt = (value) => {
return `${md5('maxi')}${shajs('sha384').update(value).digest('hex')}${shajs('sha256').update('neti').digest('hex')}`;
}
module.exports = {
encrypt
};
\ No newline at end of file
......@@ -16,7 +16,9 @@
"express": "^4.18.1",
"express-validator": "^6.14.2",
"jsonwebtoken": "^8.5.1",
"pg-promise": "^10.11.1"
"md5": "^2.3.0",
"pg-promise": "^10.11.1",
"sha.js": "^2.4.11"
}
},
"node_modules/accepts": {
......@@ -114,6 +116,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==",
"engines": {
"node": "*"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
......@@ -169,6 +179,14 @@
"node": ">= 0.10"
}
},
"node_modules/crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==",
"engines": {
"node": "*"
}
},
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
......@@ -441,6 +459,11 @@
"node": ">= 0.10"
}
},
"node_modules/is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
},
"node_modules/jsonwebtoken": {
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
......@@ -526,6 +549,16 @@
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
},
"node_modules/md5": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
"dependencies": {
"charenc": "0.0.2",
"crypt": "0.0.2",
"is-buffer": "~1.1.6"
}
},
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
......@@ -893,6 +926,18 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/sha.js": {
"version": "2.4.11",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"dependencies": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
},
"bin": {
"sha.js": "bin.js"
}
},
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
......@@ -1068,6 +1113,11 @@
"get-intrinsic": "^1.0.2"
}
},
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
......@@ -1108,6 +1158,11 @@
"vary": "^1"
}
},
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="
},
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
......@@ -1308,6 +1363,11 @@
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
},
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
},
"jsonwebtoken": {
"version": "8.5.1",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
......@@ -1391,6 +1451,16 @@
"resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz",
"integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg=="
},
"md5": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz",
"integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==",
"requires": {
"charenc": "0.0.2",
"crypt": "0.0.2",
"is-buffer": "~1.1.6"
}
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
......@@ -1652,6 +1722,15 @@
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"sha.js": {
"version": "2.4.11",
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
"requires": {
"inherits": "^2.0.1",
"safe-buffer": "^5.0.1"
}
},
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
......
......@@ -16,6 +16,8 @@
"express": "^4.18.1",
"express-validator": "^6.14.2",
"jsonwebtoken": "^8.5.1",
"pg-promise": "^10.11.1"
"md5": "^2.3.0",
"pg-promise": "^10.11.1",
"sha.js": "^2.4.11"
}
}
......@@ -3,7 +3,7 @@ const router = express.Router();
const { get_horario } = require('../controllers/horario.controller');
const { validate_jwt } = require('../middlewares');
router.get('/:documento',
router.get('/',
validate_jwt,
get_horario);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment