Skip to content

Commit 2ced7fe

Browse files
feat(monitoramento): logs específicos de denuncia
1 parent 1152ce2 commit 2ced7fe

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/controllers/denuncia.controller.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import logger from "../../logger-winston"
2020

2121

2222
export const getAllDenuncias = async (req: Request, res: Response) => {
23+
logger.info('GetAll',{rota:`denuncias/`})
2324
const query: IFilterListDenuncia = req.query
2425
const foundDenuncias = await findAllDenuncias(query)
2526
res.status(200).json(foundDenuncias)
@@ -33,18 +34,21 @@ export const getById = async (req: Request, res: Response) => {
3334
}
3435

3536
export const getUserComplaint = async (req: Request, res: Response) => {
37+
logger.info('GetDenunciasUserComplaint',{rota:`denuncias/my`})
3638
const idUsuario = req.user.id as number
3739
const filter: IFilterListDenuncia = req.query
3840
const denuncias = await findUserComplaint(idUsuario, filter)
3941
res.status(200).json(denuncias)
4042
}
4143

4244
export const getByCategoria = async (req: Request, res: Response) => {
45+
logger.info('GetDenunciasByCategoria',{rota:`denuncias/categorias`})
4346
let listCategoriaId: number[] = []
4447
let listaQuery!: string[]
4548
let idUsuario: number | undefined
4649

4750
if (!req.query.categorias) {
51+
logger.error('Nenhuma Categoria Informada',{rota:'denuncias/categorias'})
4852
res.status(400).json({
4953
error: true,
5054
message: `Nenhuma categoria foi informada`,
@@ -129,7 +133,7 @@ export const deleteDenuncia = async (req: Request, res: Response) => {
129133

130134
export const exportExcel = async (req: Request, res: Response) => {
131135
try {
132-
logger.info('ExcelDenuncias',{rota:'denuncias/'})
136+
logger.info('ExcelDenuncias',{rota:'denuncias/export'})
133137
const buffer = await exportDenunciasExcel(); // chama a função do controller
134138

135139
res.setHeader(

0 commit comments

Comments
 (0)