tango-app-api-trax 3.4.1-activitylog-9 → 3.4.1-activitylog-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,71 +6,119 @@ import * as taskconfigService from '../services/taskConfig.service.js';
|
|
|
6
6
|
export const insertLog = async ( req, res ) => {
|
|
7
7
|
try {
|
|
8
8
|
// let currentDate = new Date();
|
|
9
|
-
let inserttraxlogs = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
9
|
+
// let inserttraxlogs = {
|
|
10
|
+
// 'client_id': '11',
|
|
11
|
+
// 'createAt': new Date(),
|
|
12
|
+
// 'sourceCheckList_id': '668e3e1807d5312fa49b0046',
|
|
13
|
+
// 'checkListName': 'Daily Store Checklistnafi33',
|
|
14
|
+
// 'fromCheckListName': '',
|
|
15
|
+
// 'type': 'checklist',
|
|
16
|
+
// 'action': 'updated',
|
|
17
|
+
// 'storeName': 'LKST007',
|
|
18
|
+
// 'store_id': '',
|
|
19
|
+
// 'createdByEmail': 'lkst007bc1@lenskart.co.in',
|
|
20
|
+
// 'createdBy': 'lkst007bc1',
|
|
21
|
+
// 'coverage': 'store',
|
|
22
|
+
// 'logDetails': {
|
|
23
|
+
// 'schedule': {
|
|
24
|
+
// 'previous': {
|
|
25
|
+
// 'schedule': 'repeats',
|
|
26
|
+
// // "repeats":"daily",
|
|
27
|
+
// 'time': '10:00 AM to 11:00 PM',
|
|
28
|
+
// // "occurs":[],
|
|
29
|
+
// 'scheduleRepeatedDay': [ '01' ],
|
|
30
|
+
// 'scheduleRepeatedType': 'daily',
|
|
31
|
+
// 'scheduleStartTime_iso': '2025-02-10T23:30:00.000+00:00',
|
|
32
|
+
// 'scheduleEndTime_iso': '2025-02-10T23:30:00.000+00:00',
|
|
33
|
+
// 'configStartDate': '2025-03-11T00:00:00.000+00:00',
|
|
34
|
+
// 'configEndDate': '2025-03-12T00:00:00.000+00:00',
|
|
35
|
+
// 'scheduleWeekDays': [ 'Monday', 'Tuesday' ],
|
|
36
|
+
// 'scheduleRepeatedMonthWeek': '2 Tuesday',
|
|
37
|
+
// 'specificDate': [ '10', '11' ],
|
|
38
|
+
|
|
39
|
+
// },
|
|
40
|
+
// 'new': {
|
|
41
|
+
// 'schedule': 'onetime',
|
|
42
|
+
// // "repeats":"weekly",
|
|
43
|
+
// 'time': '10:00 AM to 11:00 PM',
|
|
44
|
+
// // "occurs":["Mondy","Tuesday"],
|
|
45
|
+
// 'scheduleRepeatedDay': [ '01' ],
|
|
46
|
+
// 'scheduleRepeatedType': 'daily',
|
|
47
|
+
// 'configStartDate': '2025-03-11T00:00:00.000+00:00',
|
|
48
|
+
// 'configEndDate': '2025-03-12T00:00:00.000+00:00',
|
|
49
|
+
// 'scheduleStartTime_iso': '2025-02-10T23:30:00.000+00:00',
|
|
50
|
+
// 'scheduleEndTime_iso': '2025-02-10T23:30:00.000+00:00',
|
|
51
|
+
// 'scheduleWeekDays': [ 'Monday', 'Tuesday' ],
|
|
52
|
+
// 'scheduleRepeatedMonthWeek': '2 Tuesday',
|
|
53
|
+
// 'specificDate': [ '10', '11' ],
|
|
54
|
+
// },
|
|
55
|
+
// },
|
|
56
|
+
// 'response': {
|
|
57
|
+
// 'previous': [ 'Geo Facing', 'Allow Multiple response' ],
|
|
58
|
+
// 'new': [ 'Geo Facing 2', 'Allow Multiple response 2' ],
|
|
59
|
+
// },
|
|
60
|
+
// 'owner': {
|
|
61
|
+
// 'previous': [ 'Ajinkya Malshe' ],
|
|
62
|
+
// 'new': [ 'Ajinkya Malshe' ],
|
|
63
|
+
// },
|
|
64
|
+
// 'approver': {
|
|
65
|
+
// 'previous': [ 'raju', 'rajuapprover' ],
|
|
66
|
+
// 'new': [ 'raju 1', 'rajuapprover 2' ],
|
|
67
|
+
// },
|
|
68
|
+
// 'storeAdded': [ 'LKST011', 'LKST022', 'LKST3444', 'LKST455', 'LKST566', 'LKST666', 'LKST766', 'LKST866', 'LkST966' ],
|
|
69
|
+
// 'storeRemoved': [ 'LKST1166', 'LKST1177', 'LKST1188', 'LKST1199', 'LKST1155', 'LKST1144', 'LKST1133', 'LKST1122', 'LkST1111' ],
|
|
70
|
+
// 'userAdded': [ 'LKST011@yopmail.com', 'LKST022@yopmail.com', 'LKST3444@yopmail.com', 'LKST455@yopmail.com', 'LKST566@yopmail.com', 'LKST666@yopmail.com', 'LKST766@yopmail.com', 'LKST866@yopmail.com', 'LkST966@yopmail.com' ],
|
|
71
|
+
// 'userRemoved': [ 'LKST1166@yopmail.com', 'LKST1177@yopmail.com', 'LKST1188@yopmail.com', 'LKST1199@yopmail.com', 'LKST1155@yopmail.com', 'LKST1144@yopmail.com', 'LKST1133@yopmail.com', 'LKST1122@yopmail.com', 'LkST1111@yopmail.com' ],
|
|
72
|
+
// },
|
|
73
|
+
// };
|
|
38
74
|
|
|
75
|
+
let inserttraxlogs = {
|
|
76
|
+
client_id: '201',
|
|
77
|
+
createAt: new Date( '2025-04-21T14:43:22.603Z' ),
|
|
78
|
+
sourceCheckList_id: '68065496feb4eaeb4515cf1d',
|
|
79
|
+
checkListName: 'Ghk',
|
|
80
|
+
fromCheckListName: '',
|
|
81
|
+
type: 'checklist',
|
|
82
|
+
action: 'draft',
|
|
83
|
+
storeName: '',
|
|
84
|
+
store_id: '',
|
|
85
|
+
createdByEmail: 'praveenraju@tangotech.co.in',
|
|
86
|
+
createdBy: 'Praveen Raju',
|
|
87
|
+
coverage: 'store',
|
|
88
|
+
logDetails: {
|
|
89
|
+
schedule: {
|
|
90
|
+
previous: {
|
|
91
|
+
scheduleDateString: '28 Apr, 2025',
|
|
92
|
+
schedule: 'onetime',
|
|
93
|
+
time: '10:00 AM to 10:00 PM',
|
|
94
|
+
scheduleRepeatedDay: '',
|
|
95
|
+
scheduleRepeatedType: 'onetime',
|
|
96
|
+
scheduleWeekDays: [],
|
|
97
|
+
scheduleRepeatedMonthWeek: '',
|
|
98
|
+
specificDate: [],
|
|
39
99
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
'scheduleStartTime_iso': '2025-02-10T23:30:00.000+00:00',
|
|
50
|
-
'scheduleEndTime_iso': '2025-02-10T23:30:00.000+00:00',
|
|
51
|
-
'scheduleWeekDays': [ 'Monday', 'Tuesday' ],
|
|
52
|
-
'scheduleRepeatedMonthWeek': '2 Tuesday',
|
|
53
|
-
'specificDate': [ '10', '11' ],
|
|
100
|
+
new: {
|
|
101
|
+
scheduleDateString: '29 Apr, 2025',
|
|
102
|
+
schedule: 'onetime',
|
|
103
|
+
time: '10:00 AM to 10:00 PM',
|
|
104
|
+
scheduleRepeatedDay: '',
|
|
105
|
+
scheduleRepeatedType: 'onetime',
|
|
106
|
+
scheduleWeekDays: [],
|
|
107
|
+
scheduleRepeatedMonthWeek: '',
|
|
108
|
+
specificDate: [],
|
|
54
109
|
},
|
|
55
110
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
'approver': {
|
|
65
|
-
'previous': [ 'raju', 'rajuapprover' ],
|
|
66
|
-
'new': [ 'raju 1', 'rajuapprover 2' ],
|
|
67
|
-
},
|
|
68
|
-
'storeAdded': [ 'LKST011', 'LKST022', 'LKST3444', 'LKST455', 'LKST566', 'LKST666', 'LKST766', 'LKST866', 'LkST966' ],
|
|
69
|
-
'storeRemoved': [ 'LKST1166', 'LKST1177', 'LKST1188', 'LKST1199', 'LKST1155', 'LKST1144', 'LKST1133', 'LKST1122', 'LkST1111' ],
|
|
70
|
-
'userAdded': [ 'LKST011@yopmail.com', 'LKST022@yopmail.com', 'LKST3444@yopmail.com', 'LKST455@yopmail.com', 'LKST566@yopmail.com', 'LKST666@yopmail.com', 'LKST766@yopmail.com', 'LKST866@yopmail.com', 'LkST966@yopmail.com' ],
|
|
71
|
-
'userRemoved': [ 'LKST1166@yopmail.com', 'LKST1177@yopmail.com', 'LKST1188@yopmail.com', 'LKST1199@yopmail.com', 'LKST1155@yopmail.com', 'LKST1144@yopmail.com', 'LKST1133@yopmail.com', 'LKST1122@yopmail.com', 'LkST1111@yopmail.com' ],
|
|
111
|
+
response: { previous: [], new: [] },
|
|
112
|
+
approver: {},
|
|
113
|
+
owner: {},
|
|
114
|
+
storeAdded: [ 'test_Eye52', 'test_Eye53' ],
|
|
115
|
+
storeRemoved: [],
|
|
116
|
+
userAdded: [],
|
|
117
|
+
userRemoved: [],
|
|
72
118
|
},
|
|
119
|
+
userType: 'tango',
|
|
73
120
|
};
|
|
121
|
+
// console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
74
122
|
let insertOS = await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, inserttraxlogs );
|
|
75
123
|
console.log( 'insertOS', insertOS );
|
|
76
124
|
return res.sendSuccess( 'insert successfully' );
|
|
@@ -79,13 +127,13 @@ export const insertLog = async ( req, res ) => {
|
|
|
79
127
|
// }
|
|
80
128
|
} catch ( e ) {
|
|
81
129
|
// logger.error( 'insertLog =>', e );
|
|
82
|
-
console.log( 'insertLog =>', e );
|
|
130
|
+
// console.log( 'insertLog =>', e );
|
|
83
131
|
return res.sendError( e, 500 );
|
|
84
132
|
}
|
|
85
133
|
};
|
|
86
134
|
export const updateLog = async ( req, res ) => {
|
|
87
135
|
try {
|
|
88
|
-
console.log( 'update' );
|
|
136
|
+
// console.log( 'update' );
|
|
89
137
|
const document = {
|
|
90
138
|
doc: {
|
|
91
139
|
storeName: 'LKST008',
|
|
@@ -96,7 +144,7 @@ export const updateLog = async ( req, res ) => {
|
|
|
96
144
|
},
|
|
97
145
|
};
|
|
98
146
|
let updateResult = await updateOpenSearchData( JSON.parse( process.env.OPENSEARCH ).traxActivityLog, '5DwBYZUBcRcpuflp5oek', document );
|
|
99
|
-
console.log( 'updateResult', updateResult );
|
|
147
|
+
// console.log( 'updateResult', updateResult );
|
|
100
148
|
if ( updateResult?.statusCode == 200 && updateResult?.body?.result == 'updated' ) {
|
|
101
149
|
return res.sendSuccess( 'Email Send Successfully' );
|
|
102
150
|
} else {
|
|
@@ -238,7 +286,7 @@ export const listLog = async ( req, res ) => {
|
|
|
238
286
|
}
|
|
239
287
|
return res.sendSuccess( { count: result.body.hits.total.value, result: result.body.hits.hits } );
|
|
240
288
|
} catch ( e ) {
|
|
241
|
-
console.log( 'listLog', e );
|
|
289
|
+
// console.log( 'listLog', e );
|
|
242
290
|
return res.sendError( e, 500 );
|
|
243
291
|
}
|
|
244
292
|
};
|
|
@@ -264,7 +264,7 @@ export async function startChecklist( req, res ) {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
267
|
-
console.log( 'openSearch', openSearch );
|
|
267
|
+
// console.log( 'openSearch', openSearch );
|
|
268
268
|
let inserttraxlogs = {
|
|
269
269
|
client_id: req.user.clientId,
|
|
270
270
|
createAt: new Date(),
|
|
@@ -288,7 +288,7 @@ export async function startChecklist( req, res ) {
|
|
|
288
288
|
return res.sendError( 'something went wrong please try again', 500 );
|
|
289
289
|
}
|
|
290
290
|
} catch ( e ) {
|
|
291
|
-
console.log( 'e =>', e );
|
|
291
|
+
// console.log( 'e =>', e );
|
|
292
292
|
logger.error( { function: 'startChecklist', error: e, body: req.body } );
|
|
293
293
|
return res.sendError( e, 500 );
|
|
294
294
|
}
|
|
@@ -455,7 +455,7 @@ export async function startTask( req, res ) {
|
|
|
455
455
|
await checklistLogs.create( logData );
|
|
456
456
|
|
|
457
457
|
let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
458
|
-
console.log( 'openSearch', openSearch );
|
|
458
|
+
// console.log( 'openSearch', openSearch );
|
|
459
459
|
let inserttraxlogs = {
|
|
460
460
|
client_id: req.user.clientId,
|
|
461
461
|
createAt: new Date(),
|
|
@@ -470,9 +470,10 @@ export async function startTask( req, res ) {
|
|
|
470
470
|
createdBy: task.userName || '',
|
|
471
471
|
coverage: task.coverage || '',
|
|
472
472
|
logDetails: {},
|
|
473
|
+
userType: req.user.userType,
|
|
473
474
|
};
|
|
474
475
|
// let insertOS = await insertOpenSearchData( 'test-traxlogs', inserttraxlogs );
|
|
475
|
-
console.log( 'inserttraxlogs', inserttraxlogs );
|
|
476
|
+
// console.log( 'inserttraxlogs', inserttraxlogs );
|
|
476
477
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
477
478
|
return res.sendSuccess( getUpdatedTask );
|
|
478
479
|
} catch ( error ) {
|
|
@@ -1847,7 +1848,7 @@ export async function submitChecklist( req, res ) {
|
|
|
1847
1848
|
userName: getchecklist[0].userName || '',
|
|
1848
1849
|
coverage: getchecklist[0].coverage || '',
|
|
1849
1850
|
};
|
|
1850
|
-
console.log( 'logInsertData=>', logInsertData );
|
|
1851
|
+
// console.log( 'logInsertData=>', logInsertData );
|
|
1851
1852
|
await checklistLogs.create( logInsertData );
|
|
1852
1853
|
// let time = dayjs().format( 'HH:mm:ss' );
|
|
1853
1854
|
// let [ hours, minutes ] = time.split( ':' ).map( Number );
|
|
@@ -1883,7 +1884,7 @@ export async function submitChecklist( req, res ) {
|
|
|
1883
1884
|
if ( requestData.submittype == 'submit' ) {
|
|
1884
1885
|
updateOpenSearch( req.user, requestData );
|
|
1885
1886
|
let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1886
|
-
console.log( 'openSearch', openSearch );
|
|
1887
|
+
// console.log( 'openSearch', openSearch );
|
|
1887
1888
|
let inserttraxlogs = {
|
|
1888
1889
|
client_id: req.user.clientId,
|
|
1889
1890
|
createAt: new Date(),
|
|
@@ -1902,7 +1903,7 @@ export async function submitChecklist( req, res ) {
|
|
|
1902
1903
|
logDetails: {},
|
|
1903
1904
|
userType: req.user.userType,
|
|
1904
1905
|
};
|
|
1905
|
-
console.log( 'inserttraxlogs', inserttraxlogs );
|
|
1906
|
+
// console.log( 'inserttraxlogs', inserttraxlogs );
|
|
1906
1907
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
1907
1908
|
}
|
|
1908
1909
|
|
|
@@ -2071,7 +2072,7 @@ export async function submitTask( req, res ) {
|
|
|
2071
2072
|
if ( submittype == 'submit' ) {
|
|
2072
2073
|
updateOpenSearchTask( user, requestData );
|
|
2073
2074
|
let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
2074
|
-
console.log( 'openSearch', openSearch );
|
|
2075
|
+
// console.log( 'openSearch', openSearch );
|
|
2075
2076
|
let inserttraxlogs = {
|
|
2076
2077
|
client_id: req.user.clientId,
|
|
2077
2078
|
createAt: new Date(),
|
|
@@ -2090,7 +2091,7 @@ export async function submitTask( req, res ) {
|
|
|
2090
2091
|
logDetails: {},
|
|
2091
2092
|
userType: req.user.userType,
|
|
2092
2093
|
};
|
|
2093
|
-
console.log( 'inserttraxlogs', inserttraxlogs );
|
|
2094
|
+
// console.log( 'inserttraxlogs', inserttraxlogs );
|
|
2094
2095
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
2095
2096
|
}
|
|
2096
2097
|
|
|
@@ -2107,7 +2108,7 @@ export async function submiteyeTestTask( req, res ) {
|
|
|
2107
2108
|
try {
|
|
2108
2109
|
const { body: requestData, user } = req;
|
|
2109
2110
|
const { processedcheckListId, date, submittype, currentTime, questionAnswers, streamId, qrCode } = requestData;
|
|
2110
|
-
console.log( requestData );
|
|
2111
|
+
// console.log( requestData );
|
|
2111
2112
|
if ( !streamId ) {
|
|
2112
2113
|
return res.sendError( 'streamId is required', 400 );
|
|
2113
2114
|
}
|
|
@@ -2119,7 +2120,7 @@ export async function submiteyeTestTask( req, res ) {
|
|
|
2119
2120
|
return res.sendError( 'Qr code already Exists', 400 );
|
|
2120
2121
|
}
|
|
2121
2122
|
let findQrExists = await cameraService.findOne( { streamName: streamId, qrCode: qrCode } );
|
|
2122
|
-
console.log( findQrExists );
|
|
2123
|
+
// console.log( findQrExists );
|
|
2123
2124
|
if ( findQrExists ) {
|
|
2124
2125
|
return res.sendError( 'Qr code already Exists', 400 );
|
|
2125
2126
|
}
|
|
@@ -2557,7 +2558,7 @@ export async function dashboardv1( req, res ) {
|
|
|
2557
2558
|
|
|
2558
2559
|
return res.sendSuccess( totalResult );
|
|
2559
2560
|
} catch ( e ) {
|
|
2560
|
-
console.log( 'v1 =>', e );
|
|
2561
|
+
// console.log( 'v1 =>', e );
|
|
2561
2562
|
logger.error( { function: 'dashboardv1', error: e, body: req.body } );
|
|
2562
2563
|
return res.sendError( e, 500 );
|
|
2563
2564
|
}
|
|
@@ -1868,7 +1868,7 @@ export const updateConfigurev1 =async ( req, res ) => {
|
|
|
1868
1868
|
logDetails: {
|
|
1869
1869
|
schedule: {
|
|
1870
1870
|
previous: {
|
|
1871
|
-
...( showSchedule && checklistDetails.schedule == 'onetime' ) ? {
|
|
1871
|
+
...( showSchedule && checklistDetails.schedule == 'onetime' ) ? { scheduleDateString: dayjs( checklistDetails?.scheduleDate, 'YYYY-MM-DD' ).format( 'DD MMM, YYYY' ) } :{},
|
|
1872
1872
|
schedule: showSchedule ? checklistDetails.schedule : '',
|
|
1873
1873
|
time: ( ( showSchedule ) && ( checklistDetails.scheduleStartTime != '' || checklistDetails.scheduleEndTime != '' ) ) ? checklistDetails.scheduleStartTime + ' to ' + checklistDetails.scheduleEndTime : '',
|
|
1874
1874
|
scheduleRepeatedDay: showSchedule ? checklistDetails?.scheduleRepeatedDay : '',
|
|
@@ -1881,7 +1881,7 @@ export const updateConfigurev1 =async ( req, res ) => {
|
|
|
1881
1881
|
|
|
1882
1882
|
},
|
|
1883
1883
|
new: {
|
|
1884
|
-
...( showSchedule && configDetails.schedule == 'onetime' ) ? {
|
|
1884
|
+
...( showSchedule && configDetails.schedule == 'onetime' ) ? { scheduleDateString: dayjs( configDetails?.scheduleDate, 'YYYY-MM-DD' ).format( 'DD MMM, YYYY' ) } :{},
|
|
1885
1885
|
schedule: showSchedule ? configDetails.schedule : '',
|
|
1886
1886
|
time: ( ( showSchedule ) && ( configDetails.scheduleStartTime != '' || configDetails.scheduleEndTime != '' ) ) ? configDetails.scheduleStartTime + ' to ' + configDetails.scheduleEndTime : '',
|
|
1887
1887
|
scheduleRepeatedDay: showSchedule ? configDetails?.scheduleRepeatedDay : '',
|