projeto-hit/backend/src/controllers/ReportController.ts

52 lines
1.2 KiB
TypeScript
Raw Normal View History

//relatorio
import { Request, Response } from "express";
import AppError from "../errors/AppError";
import ShowTicketReport from "../services/TicketServices/ShowTicketReport";
type IndexQuery = {
userId: string;
startDate: string;
endDate: string;
};
/*export const reportUser = async (req: Request, res: Response): Promise<Response> => {
const { userId } = req.params;
console.log('******* Estrou no report: ', userId)
const test = await ShowTicketReport(userId);
return res.status(200).json(test);
};*/
export const reportUserByDateStartDateEnd = async (req: Request, res: Response): Promise<Response> => {
const { userId, startDate, endDate } = req.query as IndexQuery
console.log('******* Estrou no report')
console.log('******* userId: ', userId)
console.log('******* startDate: ', startDate)
console.log('******* endDate: ', endDate)
const data_query = await ShowTicketReport(userId, startDate, endDate);
return res.status(200).json(data_query);
};
/*export const reportAll = async (req: Request, res: Response): Promise<Response> => {
const test = await ShowTicketReport();
return res.status(200).json(test);
};*/