Skip to content

Commit

Permalink
feat(CIT): Implementa llamados en lista de espera
Browse files Browse the repository at this point in the history
  • Loading branch information
ma7payne committed May 23, 2024
1 parent 5a0a4d1 commit 5c54667
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
21 changes: 12 additions & 9 deletions modules/turnos/routes/listaEspera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ router.get('/listaEspera/:id*?', (req, res, next) => {
if (req.query.documento) {
opciones['paciente.documento'] = utils.makePattern(req.query.documento);
}
}
const radix = 10;
const skip: number = parseInt(req.query.skip || 0, radix);
const limit: number = Math.min(parseInt(req.query.limit || defaultLimit, radix), maxLimit);
const query = listaEspera.find(opciones).skip(skip).limit(limit);
query.exec((err, data) => {
if (err) { return next(err); }
res.json(data);
});

const radix = 10;
const skip: number = parseInt(req.query.skip || 0, radix);
const limit: number = Math.min(parseInt(req.query.limit || defaultLimit, radix), maxLimit);
const query = listaEspera.find(opciones).skip(skip).limit(limit);
query.exec((err, data) => {
if (err) { return next(err); }
res.json(data);
});
}
});

router.post('/listaEspera', async (req, res, next) => {
Expand Down Expand Up @@ -90,6 +90,9 @@ router.patch('/listaEspera/:id/:datoMod', async (req, res, next) => {
if (datoMod === 'estado') {
data.estado = req.body;
}
if (datoMod === 'llamados') {
data.llamados = req.body;
}
Auth.audit(data, req);
data.save((errUpdate) => {
if (errUpdate) {
Expand Down
3 changes: 2 additions & 1 deletion modules/turnos/schemas/listaEspera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const listaEsperaSchema = new mongoose.Schema({
fecha: Date,
motivo: String,
observacion: String
}
},
llamados: {}
});

listaEsperaSchema.plugin(AuditPlugin);
Expand Down

0 comments on commit 5c54667

Please sign in to comment.