Adicionado codigo para pegar realizar consulta a partir dos ultimos 10 meses antes de remover atendende da fila
parent
e7eb700fb2
commit
9c351d1e9a
|
@ -17,7 +17,7 @@ import { startWhoIsOnlineMonitor, stopWhoIsOnlineMonitor } from "../helpers/WhoI
|
|||
import UserOnlineTIme from '../models/UserOnlineTime'
|
||||
import CountTicketsByUserQueue from "../services/UserServices/CountTicketsByUserQueue";
|
||||
import { splitDateTime } from "../helpers/SplitDateTime";
|
||||
import { format } from "date-fns";
|
||||
import { format, subMonths } from "date-fns";
|
||||
import { ptBR } from "date-fns/locale";
|
||||
|
||||
type IndexQuery = {
|
||||
|
@ -155,8 +155,14 @@ export const update = async (
|
|||
|
||||
const dateToday = splitDateTime(new Date(format(new Date(), 'yyyy-MM-dd HH:mm:ss', { locale: ptBR })))
|
||||
|
||||
const openByUserOnQueue: any[] = await CountTicketsByUserQueue({ startDate: dateToday.fullDate, endDate: dateToday.fullDate, status: 'open', clientChatStart: true, userId: userId })
|
||||
const currentDate = new Date();
|
||||
const tenMonthsAgo = subMonths(currentDate, 10);
|
||||
const formattedDate = format(tenMonthsAgo, 'yyyy-MM-dd');
|
||||
console.log('dateToday.fullDate: ', dateToday.fullDate )
|
||||
console.log("formattedDate 10 months ago: ", formattedDate);
|
||||
|
||||
const openByUserOnQueue: any[] = await CountTicketsByUserQueue({ startDate: formattedDate, endDate: dateToday.fullDate, status: 'open', clientChatStart: true, userId: userId })
|
||||
|
||||
// console.log('------> openByUserOnQueue: ', openByUserOnQueue)
|
||||
// console.log()
|
||||
// console.log('------> 1 userData.queueIds: ', userData.queueIds)
|
||||
|
|
Loading…
Reference in New Issue