Skip to content

Commit

Permalink
Criação de Rota de Show Tipos de ACC
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavocrvls committed Feb 21, 2021
1 parent 207000f commit 4d191bf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/controllers/TipoDeAccController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ export default {
return res.json(tipoDeAccView.renderMany(tiposDeAcc));
},

/**
* @author Gustavo Carvalho Silva
* @since 21/02/2021
*
* @description retorna um Tipo de ACC pelo id recebido na requisição
*/
async show(req: Request, res: Response): Promise<any> {
const { id } = req.params;
const tipoDeAccRepository = getRepository(TipoDeAcc);

const tipoDeAcc = await tipoDeAccRepository.findOne({
relations: ['unidade_de_medida'],
where: {
id,
},
});

return res.json({ tipoDeAcc });
},

/**
* @author Gustavo Carvalho Silva
* @since 14/11/2020
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/UnidadeDeMedidaController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import UnidadeDeMedida from '../models/UnidadeDeMedida';

/**
* @author Gustavo Carvalho Silva
* @since 21/02/2020
* @since 21/02/2021
*/
export default {
async index(req: Request, res: Response): Promise<any> {
Expand Down
5 changes: 5 additions & 0 deletions src/routes/tipos_de_acc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ routes.get(
verifyToken([PERFIL.DISCENTE, PERFIL.ADMINISTRADOR]),
TipoDeAccController.index,
);
routes.get(
'/:id',
verifyToken([PERFIL.ADMINISTRADOR]),
TipoDeAccController.show,
);
routes.get(
'/usuario/:id',
verifyToken([PERFIL.DISCENTE]),
Expand Down

0 comments on commit 4d191bf

Please sign in to comment.