tango-app-api-trax 3.4.1-activitylog-10 → 3.4.1-activitylog-12
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
|
};
|
|
@@ -282,6 +282,7 @@ export async function startChecklist( req, res ) {
|
|
|
282
282
|
userType: req.user.userType,
|
|
283
283
|
};
|
|
284
284
|
// let insertOS = await insertOpenSearchData( 'test-traxlogs', inserttraxlogs );
|
|
285
|
+
console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
285
286
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
286
287
|
return res.sendSuccess( getchecklist );
|
|
287
288
|
} else {
|
|
@@ -473,7 +474,7 @@ export async function startTask( req, res ) {
|
|
|
473
474
|
userType: req.user.userType,
|
|
474
475
|
};
|
|
475
476
|
// let insertOS = await insertOpenSearchData( 'test-traxlogs', inserttraxlogs );
|
|
476
|
-
|
|
477
|
+
console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
477
478
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
478
479
|
return res.sendSuccess( getUpdatedTask );
|
|
479
480
|
} catch ( error ) {
|
|
@@ -1903,7 +1904,7 @@ export async function submitChecklist( req, res ) {
|
|
|
1903
1904
|
logDetails: {},
|
|
1904
1905
|
userType: req.user.userType,
|
|
1905
1906
|
};
|
|
1906
|
-
|
|
1907
|
+
console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
1907
1908
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
1908
1909
|
}
|
|
1909
1910
|
|
|
@@ -2091,7 +2092,7 @@ export async function submitTask( req, res ) {
|
|
|
2091
2092
|
logDetails: {},
|
|
2092
2093
|
userType: req.user.userType,
|
|
2093
2094
|
};
|
|
2094
|
-
|
|
2095
|
+
console.log( 'inserttraxlogs =>', inserttraxlogs );
|
|
2095
2096
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
2096
2097
|
}
|
|
2097
2098
|
|
|
@@ -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 : '',
|