32 lines
719 B
TypeScript
32 lines
719 B
TypeScript
//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 reportUserByDateStartDateEnd = async (req: Request, res: Response): Promise<Response> => {
|
|
|
|
if (req.user.profile !== "master" && req.user.profile !== "admin") {
|
|
throw new AppError("ERR_NO_PERMISSION", 403);
|
|
}
|
|
|
|
const { userId, startDate, endDate } = req.query as IndexQuery
|
|
|
|
const data_query = await ShowTicketReport(userId, startDate, endDate);
|
|
|
|
return res.status(200).json(data_query);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|