Limpeza de comentários na master
parent
c7fa85c509
commit
c6d6ec2103
|
@ -51,11 +51,6 @@ export const reportUserService= async (req: Request, res: Response): Promise<Res
|
|||
const { userId, startDate, endDate } = req.query as IndexQuery
|
||||
|
||||
|
||||
//test del
|
||||
console.log('startDate: ', startDate)
|
||||
console.log('endDate: ', endDate)
|
||||
console.log('userId: ', userId)
|
||||
|
||||
let usersProfile = await ListUserParamiterService({profile: 'user'})
|
||||
|
||||
const sumUserOlineTime = await ShowUserServiceReport({startDate, endDate, userId});
|
||||
|
@ -65,12 +60,6 @@ export const reportUserService= async (req: Request, res: Response): Promise<Res
|
|||
let dateTime = splitDateTime(new Date(format(new Date(), 'yyyy-MM-dd HH:mm:ss', { locale: ptBR })))
|
||||
const onlineUsers = await ListUserOnlineOffline({ date: dateTime.fullDate })
|
||||
|
||||
console.log('sumUserOlineTime: ',sumUserOlineTime )
|
||||
console.log('closedByUser: ',closedByUser )
|
||||
console.log('openByUser: ',openByUser )
|
||||
console.log('usersProfile: ', usersProfile)
|
||||
console.log('')
|
||||
|
||||
|
||||
usersProfile.map((user:any) => {
|
||||
|
||||
|
@ -110,12 +99,6 @@ export const reportUserService= async (req: Request, res: Response): Promise<Res
|
|||
}
|
||||
|
||||
})
|
||||
console.log('')
|
||||
console.log('usersProfile2: ',usersProfile)
|
||||
//
|
||||
|
||||
|
||||
// const data_query = await ShowTicketReport(userId, startDate, endDate);
|
||||
|
||||
return res.status(200).json(usersProfile);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import DeleteSchedulingNotifyService from "../services/SchedulingNotifyServices
|
|||
|
||||
|
||||
let scheduler_monitor:any;
|
||||
let timeInterval = 5
|
||||
|
||||
const monitor = async () => {
|
||||
|
||||
|
@ -45,6 +46,8 @@ const monitor = async () => {
|
|||
|
||||
} catch (error) {
|
||||
console.log('>>> SchedulingNotifiySendMessage.ts error: ', error)
|
||||
stopSchedulingMonitor()
|
||||
startSchedulingMonitor(timeInterval)
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -52,6 +55,8 @@ const monitor = async () => {
|
|||
|
||||
export const startSchedulingMonitor =async (mileseconds: number) => {
|
||||
|
||||
timeInterval = mileseconds
|
||||
|
||||
scheduler_monitor = setInterval(monitor, mileseconds)
|
||||
|
||||
}
|
||||
|
|
|
@ -31,18 +31,6 @@ let lstOnline: any = []
|
|||
let deleted: boolean = false;
|
||||
|
||||
|
||||
const setOfflineAllUsers = async () => {
|
||||
|
||||
// const onlineUsers = await ListUserOnlineOffline({ date: dateTime.fullDate, status: 'online' })
|
||||
|
||||
// console.log('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX onlineUsers: ', onlineUsers)
|
||||
|
||||
// if (onlineUsers.length > 0) {
|
||||
// onlineUsers.forEach(async user => {
|
||||
// await createOrUpdateOnlineUserService({ userId: user.userId, status: 'offline' })
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
const emitterOnline = (user: any, status: string, showOnlineTime: boolean = true) => {
|
||||
|
||||
|
@ -73,38 +61,37 @@ const emitterOnline = (user: any, status: string, showOnlineTime: boolean = true
|
|||
|
||||
const monitor = async () => {
|
||||
|
||||
const test = require('./../libs/socket');
|
||||
try {
|
||||
|
||||
if (test.ob) {
|
||||
const usersSocket = require('./../libs/socket');
|
||||
|
||||
if (usersSocket.ob) {
|
||||
|
||||
if (count > 1) {
|
||||
count = 0
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
uuid = test.ob.uuid
|
||||
uuid = usersSocket.ob.uuid
|
||||
}
|
||||
|
||||
if (count == 1) {
|
||||
if (uuid) {
|
||||
if (uuid == test.ob.uuid) {
|
||||
if (uuid == usersSocket.ob.uuid) {
|
||||
|
||||
console.log('ALL USERS CLIENTS OFFLINE 1...........')
|
||||
|
||||
//await setOfflineAllUsers()
|
||||
test.ob.listOnline = []
|
||||
test.ob.listOnlineAux = []
|
||||
test.ob.uuid = undefined
|
||||
usersSocket.ob.listOnline = []
|
||||
usersSocket.ob.listOnlineAux = []
|
||||
usersSocket.ob.uuid = undefined
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
// console.log(' * TEST OBJ', test.ob)
|
||||
|
||||
|
||||
test.ob.listOnline.forEach(async (el: any) => {
|
||||
usersSocket.ob.listOnline.forEach(async (el: any) => {
|
||||
|
||||
|
||||
const indexAux = lstOnline.findIndex((e: any) => e.id == el.id)
|
||||
|
@ -139,12 +126,8 @@ const monitor = async () => {
|
|||
});
|
||||
|
||||
|
||||
// console.log('----------- 1 lstOnline: ', lstOnline)
|
||||
|
||||
|
||||
let difference = lstOnline.filter((x: any) => !test.ob.listOnline.map((e: any) => e.id).includes(x.id));
|
||||
|
||||
// console.log(' * diference: ', difference)
|
||||
let difference = lstOnline.filter((x: any) => !usersSocket.ob.listOnline.map((e: any) => e.id).includes(x.id));
|
||||
|
||||
difference.forEach(async (e: any) => {
|
||||
|
||||
|
@ -154,14 +137,8 @@ const monitor = async () => {
|
|||
|
||||
lstOnline.splice(index, 1)
|
||||
|
||||
// console.log('----------- 2 lstOnline: ', lstOnline)
|
||||
|
||||
const userOnline = await createOrUpdateOnlineUserService({ userId: e.id, status: 'offline' })
|
||||
|
||||
if (userOnline) {
|
||||
// console.log(' * UPDATED USER TO OFFLINE: ', userOnline.userId)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -170,9 +147,7 @@ const monitor = async () => {
|
|||
|
||||
}
|
||||
|
||||
|
||||
count++
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -182,7 +157,7 @@ const monitor = async () => {
|
|||
|
||||
if (countTest == 0) {
|
||||
try {
|
||||
console.log(' Carregando usuárion no listUserId...')
|
||||
// console.log(' Carregando usuárion no listUserId...')
|
||||
listUserId = await ListUserParamiterService({ profile: 'user' })
|
||||
|
||||
} catch (error) {
|
||||
|
@ -196,13 +171,15 @@ const monitor = async () => {
|
|||
|
||||
listUserId.forEach((u) => {
|
||||
|
||||
// console.log(' *** listUserId: ', listUserId)
|
||||
const io = getIO();
|
||||
io.emit("isOnline", { action: "online", userId: u.id });
|
||||
});
|
||||
|
||||
|
||||
// console.log('***************** TIME INTERVAL: ', timeInterval)
|
||||
} catch (error) {
|
||||
console.log('>>> There was an error no WhoIsOnlineMonitor.ts: ',error)
|
||||
stopWhoIsOnlineMonitor()
|
||||
startWhoIsOnlineMonitor()
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -33,11 +33,6 @@ let lstTry: any[] = []
|
|||
|
||||
let dateTime = splitDateTime(new Date(format(new Date(), 'yyyy-MM-dd HH:mm:ss', { locale: ptBR })))
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const initIO = (httpServer: Server): SocketIO => {
|
||||
io = new SocketIO(httpServer, {
|
||||
|
@ -131,7 +126,6 @@ export const initIO = (httpServer: Server): SocketIO => {
|
|||
|
||||
var difference = lstOnline.filter((x: any) => !lstOnlineAux.map((e: any) => e.id).includes(x.id));
|
||||
|
||||
//console.log('>>>>>>>>>>> difference: ', difference)
|
||||
|
||||
if (difference.length > 0) {
|
||||
|
||||
|
@ -156,15 +150,11 @@ export const initIO = (httpServer: Server): SocketIO => {
|
|||
|
||||
})
|
||||
|
||||
// console.log(' difference2: ', difference)
|
||||
|
||||
}
|
||||
obj.listOnline = lstOnline
|
||||
obj.listOnlineAux = lstOnlineAux
|
||||
|
||||
// console.log(' >>>>>> lstOnline: ', lstOnline)
|
||||
// console.log('')
|
||||
// console.log(' >>>>>> lstOnlineAux: ', lstOnlineAux)
|
||||
|
||||
lstOnlineAux = []
|
||||
listOnlineAux = []
|
||||
|
|
Loading…
Reference in New Issue