Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FEAT) Demanda Insatisfecha: pasar funcionalidad a API #1893

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JuanIRamirez
Copy link
Contributor

Requerimiento

Funcionalidad desarrollada

  1. En ../routes/listaEspera.ts se modificó método post(...) para que decida si agrega un doc a la colección o una demanda al un doc. existente.
  2. en ../schemas/listaEspera.ts se agregó: 'export const demanda' para poder auditar (Auth.audit) el elemento.

UserStories llegó a completarse

  • Si
  • No

Requiere actualizaciones en la base de datos

  • Si
  • No

origen: req.body.demandas[0].origen
};

const query: any = await listaEspera.find(params, (data: any) => { return data; });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se recomienta que las operaciones con async/await queden siempre dentro de bloques try-catch para poder manejar los errores.

try {
    const query: any = await listaEspera.find(params, (data: any) => { return data; });
    ...
    // todo el contenido del bloque
    ...
    const itemSaved = await newItem.save();  // realizar el save en este formato, al estar dentro del boque del try los posibles errores se van por el catch
    res.json(itemSaved);
}, catch (error) {
    return next(''algun mensaje de error que va a llegar al usuario');
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corregido

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants