Relatório funcinal com datas formatadas

pull/1/head
adriano 2022-01-25 23:05:48 -03:00
parent 1b4347d585
commit 2e0f41769b
2 changed files with 12 additions and 4 deletions

View File

@ -44,13 +44,21 @@ const ShowTicketReport = async (id: string | number, startDate: string, endDate:
const ticket = await Ticket.findAll({
where: where_clause ,
attributes: ['id', 'status', 'createdAt', 'updatedAt'],
//attributes: ['id', 'status', 'createdAt', 'updatedAt'],
attributes: ['id', 'status', [Sequelize.fn("DATE_FORMAT",Sequelize.col("Ticket.createdAt"),"%d/%m/%Y %H:%i:%s"),"createdAt"],
[Sequelize.fn("DATE_FORMAT",Sequelize.col("Ticket.updatedAt"),"%d/%m/%Y %H:%i:%s"),"updatedAt"]],
include: [
{
model: Message,
required:true,
separate: true,
attributes: ['body', 'read', 'mediaType','fromMe', 'mediaUrl','createdAt'],
// attributes: ['body', 'read', 'mediaType','fromMe', 'mediaUrl','createdAt'],
attributes: ['body', 'read', 'mediaType','fromMe', 'mediaUrl', [Sequelize.fn("DATE_FORMAT",Sequelize.col("createdAt"),"%d/%m/%Y %H:%i:%s"),"createdAt"]],
order: [
['createdAt', 'ASC']
]

View File

@ -218,9 +218,9 @@ const Report = () => {
const fetchQueries = async () => {
try {
/*const dataQuery = await api.get("/reports/", {params: {userId, startDate, endDate },});
const dataQuery = await api.get("/reports/", {params: {userId, startDate, endDate },});
dispatchQ({ type: "RESET" })
dispatchQ({ type: "LOAD_QUERY", payload: dataQuery.data }); */
dispatchQ({ type: "LOAD_QUERY", payload: dataQuery.data });
setLoading(false);