Commit 87e61265 by Denys Tito Urbano

Router horario agregado

parent 47aea8f4
const service = require('../services/horario.service');
const get_horario = async (req, res) => {
try {
const { documento } = req.params;
const salida = await service.get_horario({ documento });
res.json(salida);
} catch (error) {
res.status(400).json({ error });
}
};
module.exports = {
get_horario
};
\ No newline at end of file
const connection = require('./config');
const get_horario = async ({ documento }) => {
return await connection.oneOrNone('SELECT * FROM academico.func_tma_horario_obtener ( $1 );', [documento]);
};
module.exports = {
get_horario
};
\ No newline at end of file
const express = require('express');
const router = express.Router();
const { get_horario } = require('../controllers/horario.controller');
const { validate_jwt } = require('../middlewares');
router.get('/:documento',
validate_jwt,
get_horario);
module.exports = router;
\ No newline at end of file
......@@ -13,6 +13,7 @@ class Server {
routes() {
this.app.use('/api/auth', require('./routes/auth.router'));
this.app.use('/api/horarios', require('./routes/horario.router'));
}
middlewares() {
......
const db = require('../db/horario.db');
const get_horario = async (input) => {
return await db.get_horario(input);
};
module.exports = {
get_horario
};
\ No newline at end of file
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