tango-app-api-trax 3.7.12-qid-5 → 3.7.13-qid-halfshutter-1
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 +1 -1
- package/src/controllers/gallery.controller.js +215 -0
- package/src/controllers/internalTrax.controller.js +22 -22
- package/src/controllers/mobileTrax.controller.js +125 -123
- package/src/controllers/teaxFlag.controller.js +9 -8
- package/src/controllers/trax.controller.js +162 -105
- package/src/dtos/validation.dtos.js +16 -1
- package/src/routes/gallery.routes.js +3 -1
- package/src/routes/trax.routes.js +4 -3
package/package.json
CHANGED
|
@@ -1081,7 +1081,222 @@ async function getLocationStores( userClientId, cityList, req ) {
|
|
|
1081
1081
|
return false;
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
|
+
export async function headerClustersV2( req, res ) {
|
|
1085
|
+
try {
|
|
1086
|
+
let requestData = req.body;
|
|
1087
|
+
let getUserEmail = req.user.email;
|
|
1088
|
+
let clientId = req?.user?.clientId;
|
|
1089
|
+
let getUserType = req.user.userType;
|
|
1090
|
+
let getRole = req.user.role;
|
|
1091
|
+
let clusterNames=[];
|
|
1092
|
+
if ( requestData.city && requestData.city.length>0 ) {
|
|
1093
|
+
let getcityclustes = await getCityClusters( requestData.clientId, getUserEmail, getRole, requestData.city, getUserType, req );
|
|
1094
|
+
if ( getcityclustes && getcityclustes.length>0 ) {
|
|
1095
|
+
clusterNames = getcityclustes;
|
|
1096
|
+
} else {
|
|
1097
|
+
clusterNames = [];
|
|
1098
|
+
}
|
|
1099
|
+
} else {
|
|
1100
|
+
if ( getUserType == 'tango' ) {
|
|
1101
|
+
clusterNames = await getclusterList( requestData.clientId, getUserType, getRole, req );
|
|
1102
|
+
} else if ( getUserType == 'client' ) {
|
|
1103
|
+
if ( getRole == 'superadmin' ) {
|
|
1104
|
+
clusterNames = await getclusterList( clientId, getUserType, getRole, req );
|
|
1105
|
+
} else {
|
|
1106
|
+
clusterNames = await getclusterList( clientId, getUserType, getRole, req );
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
if ( clusterNames.length>0 ) {
|
|
1111
|
+
const dataObjects = clusterNames.map( ( item ) => ( { groupName: item } ) );
|
|
1112
|
+
res.sendSuccess( { groupData: dataObjects } );
|
|
1113
|
+
} else {
|
|
1114
|
+
res.sendSuccess( { groupData: [] } );
|
|
1115
|
+
}
|
|
1116
|
+
} catch ( error ) {
|
|
1117
|
+
logger.error( { error: error, message: req.query, function: 'headerClustersV2' } );
|
|
1118
|
+
return res.sendError( { error: error }, 500 );
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
async function getCityClusters( userClientId, getUserEmail, getRole, requestCity, getUserType, req ) {
|
|
1122
|
+
try {
|
|
1123
|
+
if ( userClientId && userClientId !='' && getUserEmail && getUserEmail !='', getRole && getRole !='', requestCity && requestCity.length>0 ) {
|
|
1124
|
+
let cityStores = await getLocationStores( userClientId, requestCity, req );
|
|
1125
|
+
if ( cityStores && cityStores.length > 0 ) {
|
|
1126
|
+
let storeGroups = await getClusterStoresIds( userClientId, cityStores, getRole, getUserType, getUserEmail, req );
|
|
1127
|
+
if ( storeGroups && storeGroups.length > 0 ) {
|
|
1128
|
+
return storeGroups;
|
|
1129
|
+
} else {
|
|
1130
|
+
return false;
|
|
1131
|
+
}
|
|
1132
|
+
} else {
|
|
1133
|
+
return false;
|
|
1134
|
+
}
|
|
1135
|
+
} else {
|
|
1136
|
+
return false;
|
|
1137
|
+
}
|
|
1138
|
+
} catch ( error ) {
|
|
1139
|
+
logger.error( { error: error, function: 'getCityClusters' } );
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
async function getclusterList( userClientId, getUserType, getRole, req ) {
|
|
1144
|
+
try {
|
|
1145
|
+
if ( userClientId && userClientId !='' || getUserType === 'tango' ) {
|
|
1146
|
+
let filter = [];
|
|
1147
|
+
if ( userClientId && userClientId !='' ) {
|
|
1148
|
+
filter.push( { clientId: { $eq: userClientId } },
|
|
1149
|
+
);
|
|
1150
|
+
}
|
|
1151
|
+
if ( req.body.assignedStores&&req.body.assignedStores.length>0 ) {
|
|
1152
|
+
filter.push( { 'stores.storeId': { $in: req.body.assignedStores } } );
|
|
1153
|
+
}
|
|
1154
|
+
if ( getUserType == 'client'&&getRole!='superadmin' ) {
|
|
1155
|
+
filter.push( { 'Teamlead.email': req.user.email } );
|
|
1156
|
+
}
|
|
1157
|
+
let clusterQuery = [];
|
|
1158
|
+
|
|
1159
|
+
if ( filter.length > 0 ) {
|
|
1160
|
+
clusterQuery.push( { $match: { $and: filter } } );
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
clusterQuery.push( {
|
|
1164
|
+
$group: {
|
|
1165
|
+
_id: null,
|
|
1166
|
+
clusterName: { $push: '$clusterName' },
|
|
1167
|
+
},
|
|
1168
|
+
} );
|
|
1169
|
+
const clusterIds = await clusterService.aggregateCluster( clusterQuery );
|
|
1170
|
+
if ( clusterIds && clusterIds.length>0 && clusterIds[0]?.clusterName.length > 0 ) {
|
|
1171
|
+
let uniqueclusterIds = [ ...new Set( clusterIds[0].clusterName ) ];
|
|
1172
|
+
return uniqueclusterIds;
|
|
1173
|
+
} else {
|
|
1174
|
+
return false;
|
|
1175
|
+
}
|
|
1176
|
+
} else {
|
|
1177
|
+
return false;
|
|
1178
|
+
}
|
|
1179
|
+
} catch ( error ) {
|
|
1180
|
+
logger.error( { error: error, function: 'getclusterList' } );
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
async function getClusterStoresIds( userClientId, storeIds, getRole, getUserType, getUserEmail, req ) {
|
|
1185
|
+
try {
|
|
1186
|
+
if ( userClientId && userClientId !='' && storeIds && storeIds !='' && getRole && getRole !='' && getUserType && getUserType !='', getUserEmail && getUserEmail !='' ) {
|
|
1187
|
+
let clusterQuery = [];
|
|
1188
|
+
if ( getUserType == 'client' ) {
|
|
1189
|
+
if ( getRole == 'superadmin' ) {
|
|
1190
|
+
clusterQuery = [
|
|
1191
|
+
{
|
|
1192
|
+
$match: {
|
|
1193
|
+
$and: [
|
|
1194
|
+
{ clientId: { $eq: userClientId } },
|
|
1195
|
+
{ 'stores.storeId': { $in: storeIds } },
|
|
1196
|
+
],
|
|
1197
|
+
},
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
$group: {
|
|
1201
|
+
_id: null,
|
|
1202
|
+
clusterName: { $push: '$clusterName' },
|
|
1203
|
+
},
|
|
1204
|
+
},
|
|
1205
|
+
];
|
|
1206
|
+
} else {
|
|
1207
|
+
let getAssignedGroupIds = [
|
|
1208
|
+
{
|
|
1209
|
+
$match: {
|
|
1210
|
+
$and: [
|
|
1211
|
+
{ clientId: { $eq: userClientId } },
|
|
1212
|
+
{ 'stores.storeId': { $in: storeIds } },
|
|
1213
|
+
{ 'Teamlead.email': req.user.email },
|
|
1214
|
+
],
|
|
1215
|
+
},
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
$group: {
|
|
1219
|
+
_id: null,
|
|
1220
|
+
clusterName: { $push: '$clusterName' },
|
|
1221
|
+
},
|
|
1222
|
+
},
|
|
1223
|
+
];
|
|
1224
|
+
const assignedclusters = await clusterService.aggregateCluster( getAssignedGroupIds );
|
|
1225
|
+
if ( assignedclusters && assignedclusters.length>0 && assignedclusters[0]?.clusterName.length > 0 ) {
|
|
1226
|
+
let uniqueclusters = [ ...new Set( assignedclusters[0].clusterName ) ];
|
|
1227
|
+
return uniqueclusters;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
} else if ( getUserType == 'tango' ) {
|
|
1231
|
+
clusterQuery = [
|
|
1232
|
+
{
|
|
1233
|
+
$match: {
|
|
1234
|
+
$and: [
|
|
1235
|
+
{ clientId: { $eq: userClientId } },
|
|
1236
|
+
{ 'stores.storeId': { $in: storeIds } },
|
|
1237
|
+
],
|
|
1238
|
+
},
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
$group: {
|
|
1242
|
+
_id: null,
|
|
1243
|
+
clusterName: { $push: '$clusterName' },
|
|
1244
|
+
},
|
|
1245
|
+
},
|
|
1246
|
+
];
|
|
1247
|
+
}
|
|
1084
1248
|
|
|
1249
|
+
const assignedclusters = await clusterService.aggregateCluster( clusterQuery );
|
|
1250
|
+
if ( assignedclusters && assignedclusters.length>0 && assignedclusters[0]?.clusterName.length > 0 ) {
|
|
1251
|
+
let uniqueclusters = [ ...new Set( assignedclusters[0].clusterName ) ];
|
|
1252
|
+
return uniqueclusters;
|
|
1253
|
+
} else {
|
|
1254
|
+
return false;
|
|
1255
|
+
}
|
|
1256
|
+
} else {
|
|
1257
|
+
return false;
|
|
1258
|
+
}
|
|
1259
|
+
} catch ( error ) {
|
|
1260
|
+
logger.error( { error: error, function: 'getGroupIds' } );
|
|
1261
|
+
return false;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
export const headerLocationsV2 = async ( req, res ) => {
|
|
1265
|
+
try {
|
|
1266
|
+
let reqestData = req.body;
|
|
1267
|
+
let getUserEmail = req.user.email;
|
|
1268
|
+
let getUserType = req.user.userType;
|
|
1269
|
+
let getRole = req.user.role;
|
|
1270
|
+
let getClientId = reqestData.clientId;
|
|
1271
|
+
let totalStores = await getStoresList( getUserEmail, getClientId, getUserType, getRole, req );
|
|
1272
|
+
if ( totalStores && totalStores.length>0 ) {
|
|
1273
|
+
let storeQuery = [];
|
|
1274
|
+
storeQuery.push( { $match: { $and: [ { clientId: { $eq: getClientId } }, { storeId: { $in: totalStores } } ] } } );
|
|
1275
|
+
|
|
1276
|
+
if ( reqestData.country && reqestData.country.length>0 ) {
|
|
1277
|
+
storeQuery.push( { $match: { $and: [ { 'storeProfile.country': { $in: reqestData.country || [] } } ] } } );
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
storeQuery.push(
|
|
1281
|
+
{ $group: { _id: '$storeProfile.city' } },
|
|
1282
|
+
{ $project: { _id: 0, city: '$_id' } },
|
|
1283
|
+
{ $sort: { city: -1 } },
|
|
1284
|
+
);
|
|
1285
|
+
const cityList = await storeService.aggregate( storeQuery );
|
|
1286
|
+
if ( cityList && cityList.length > 0 ) {
|
|
1287
|
+
let city = cityList.filter( ( data ) => data.city!='' );
|
|
1288
|
+
return res.sendSuccess( { locationData: city } );
|
|
1289
|
+
} else {
|
|
1290
|
+
return res.sendError( 'No City', 400 );
|
|
1291
|
+
}
|
|
1292
|
+
} else {
|
|
1293
|
+
return res.sendError( 'No stores', 400 );
|
|
1294
|
+
}
|
|
1295
|
+
} catch ( error ) {
|
|
1296
|
+
logger.error( { error: error, message: req.query, function: 'trafficCards' } );
|
|
1297
|
+
return res.sendError( { error: error }, 500 );
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1085
1300
|
export async function teamsList( req, res ) {
|
|
1086
1301
|
try {
|
|
1087
1302
|
let query = [
|
|
@@ -3,7 +3,7 @@ import * as CLconfig from '../services/checklist.service.js';
|
|
|
3
3
|
import * as CLquestions from '../services/checklistQuestion.service.js';
|
|
4
4
|
import * as PCLconfig from '../services/processedchecklistconfig.services.js';
|
|
5
5
|
import * as CLassign from '../services/checklistAssign.service.js';
|
|
6
|
-
import * as checklistLogs from '../services/checklistlog.service.js';
|
|
6
|
+
// import * as checklistLogs from '../services/checklistlog.service.js';
|
|
7
7
|
import * as lenskartEmployeeMapping from '../services/lenskartEmployeeMapping.service.js';
|
|
8
8
|
import * as otpServices from '../services/otp.service.js';
|
|
9
9
|
import * as downloadServices from '../services/download.services.js';
|
|
@@ -303,7 +303,7 @@ export async function PCLconfigCreation( req, res ) {
|
|
|
303
303
|
},
|
|
304
304
|
} );
|
|
305
305
|
let getSections = await CLquestions.aggregate( sectionQuery );
|
|
306
|
-
if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
306
|
+
if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
307
307
|
if ( getSections.length ) {
|
|
308
308
|
for ( let element3 of getSections ) {
|
|
309
309
|
let collectQuestions = {};
|
|
@@ -601,11 +601,11 @@ export async function PCLconfigCreation( req, res ) {
|
|
|
601
601
|
// }
|
|
602
602
|
}
|
|
603
603
|
} else {
|
|
604
|
-
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
604
|
+
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
605
605
|
let storeNameList = allQuestion.map( ( item ) => item.store_id );
|
|
606
|
-
let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
|
|
606
|
+
let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
|
|
607
607
|
let storeList = storeDetails.map( ( store ) => store.storeId );
|
|
608
|
-
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
608
|
+
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
609
609
|
allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
|
|
610
610
|
} else {
|
|
611
611
|
allQuestion = storeDetails.map( ( item ) => {
|
|
@@ -639,7 +639,7 @@ export async function PCLconfigCreation( req, res ) {
|
|
|
639
639
|
client_id: getCLconfig.client_id,
|
|
640
640
|
aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
|
|
641
641
|
};
|
|
642
|
-
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
642
|
+
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
643
643
|
let processData = {
|
|
644
644
|
aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
|
|
645
645
|
return { storeName: store.storeName, storeId: store.store_id, events: store.events };
|
|
@@ -879,7 +879,7 @@ async function insertData( requestData ) {
|
|
|
879
879
|
},
|
|
880
880
|
} );
|
|
881
881
|
let getSections = await CLquestions.aggregate( sectionQuery );
|
|
882
|
-
if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
882
|
+
if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
883
883
|
if ( getSections.length ) {
|
|
884
884
|
for ( let element3 of getSections ) {
|
|
885
885
|
let collectQuestions = {};
|
|
@@ -1173,11 +1173,11 @@ async function insertData( requestData ) {
|
|
|
1173
1173
|
// }
|
|
1174
1174
|
}
|
|
1175
1175
|
} else {
|
|
1176
|
-
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
1176
|
+
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
1177
1177
|
let storeNameList = allQuestion.map( ( item ) => item.store_id );
|
|
1178
|
-
let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
|
|
1178
|
+
let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active', ...( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) ? { storeId: { $in: storeNameList } } : {} }, { storeId: 1 } );
|
|
1179
1179
|
let storeList = storeDetails.map( ( store ) => store.storeId );
|
|
1180
|
-
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
1180
|
+
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
1181
1181
|
allQuestion = allQuestion.filter( ( ele ) => storeList.includes( ele?.store_id ) );
|
|
1182
1182
|
} else {
|
|
1183
1183
|
allQuestion = storeDetails.map( ( item ) => {
|
|
@@ -1211,7 +1211,7 @@ async function insertData( requestData ) {
|
|
|
1211
1211
|
client_id: getCLconfig.client_id,
|
|
1212
1212
|
aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
|
|
1213
1213
|
};
|
|
1214
|
-
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking' ].includes( getCLconfig.checkListType ) ) {
|
|
1214
|
+
if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( getCLconfig.checkListType ) ) {
|
|
1215
1215
|
let processData = {
|
|
1216
1216
|
aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
|
|
1217
1217
|
return { storeName: store.storeName, storeId: store.store_id, events: store.events };
|
|
@@ -1307,17 +1307,17 @@ export async function insertTimeDelayFlags( req, res ) {
|
|
|
1307
1307
|
let checklistDate = dayjs.utc( data.scheduleEndTime_iso ).format();
|
|
1308
1308
|
let date = dayjs.utc().tz( getStoreZone.storeProfile.timeZone ).format();
|
|
1309
1309
|
if ( checklistDate < date ) {
|
|
1310
|
-
let logInsertData = {
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
};
|
|
1320
|
-
await checklistLogs.create( logInsertData );
|
|
1310
|
+
// let logInsertData = {
|
|
1311
|
+
// store_id: data.store_id,
|
|
1312
|
+
// storeName: data.storeName,
|
|
1313
|
+
// action: 'lapsed',
|
|
1314
|
+
// checklistId: data.checkListId,
|
|
1315
|
+
// checkListName: data.checkListName,
|
|
1316
|
+
// client_id: data.client_id,
|
|
1317
|
+
// date_iso: data.date_iso,
|
|
1318
|
+
// processedChecklistId: data._id,
|
|
1319
|
+
// };
|
|
1320
|
+
// await checklistLogs.create( logInsertData );
|
|
1321
1321
|
checklistId.push( data._id );
|
|
1322
1322
|
}
|
|
1323
1323
|
}
|
|
@@ -7,7 +7,7 @@ import * as storeService from '../services/store.service.js';
|
|
|
7
7
|
import * as checklistService from '../services/checklist.service.js';
|
|
8
8
|
import * as taskConfigService from '../services/taskConfig.service.js';
|
|
9
9
|
import * as processedTask from '../services/processedTaskList.service.js';
|
|
10
|
-
import * as checklistLogs from '../services/checklistlog.service.js';
|
|
10
|
+
// import * as checklistLogs from '../services/checklistlog.service.js';
|
|
11
11
|
import { insertSingleProcessData } from './trax.controller.js';
|
|
12
12
|
import * as userService from '../services/user.service.js';
|
|
13
13
|
import dayjs from 'dayjs';
|
|
@@ -227,20 +227,20 @@ export async function startChecklist( req, res ) {
|
|
|
227
227
|
} );
|
|
228
228
|
} );
|
|
229
229
|
} );
|
|
230
|
-
let logInsertData = {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
};
|
|
243
|
-
await checklistLogs.create( logInsertData );
|
|
230
|
+
// let logInsertData = {
|
|
231
|
+
// store_id: getBeforeChecklist[0]?.store_id || '',
|
|
232
|
+
// storeName: getBeforeChecklist[0]?.storeName || '',
|
|
233
|
+
// action: 'started',
|
|
234
|
+
// checklistId: getBeforeChecklist[0].sourceCheckList_id,
|
|
235
|
+
// processedChecklistId: getBeforeChecklist[0]._id,
|
|
236
|
+
// checkListName: getBeforeChecklist[0].checkListName,
|
|
237
|
+
// type: getBeforeChecklist[0].checkListType,
|
|
238
|
+
// client_id: req.user.clientId,
|
|
239
|
+
// userEmail: getBeforeChecklist[0].userEmail || '',
|
|
240
|
+
// userName: getBeforeChecklist[0].userName || '',
|
|
241
|
+
// coverage: getBeforeChecklist[0].coverage || '',
|
|
242
|
+
// };
|
|
243
|
+
// await checklistLogs.create( logInsertData );
|
|
244
244
|
let getchecklist = getupdatedchecklist;
|
|
245
245
|
let questions = [];
|
|
246
246
|
function processQuestion( question, section, questions, nested=false ) {
|
|
@@ -483,17 +483,17 @@ export async function startTask( req, res ) {
|
|
|
483
483
|
);
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
-
const logData = {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
};
|
|
496
|
-
await checklistLogs.create( logData );
|
|
486
|
+
// const logData = {
|
|
487
|
+
// store_id: task.store_id,
|
|
488
|
+
// storeName: task.storeName,
|
|
489
|
+
// type: 'task',
|
|
490
|
+
// action: 'started',
|
|
491
|
+
// checklistId: task.checkListId,
|
|
492
|
+
// checkListName: task.checkListName,
|
|
493
|
+
// checkListType: task.checkListType,
|
|
494
|
+
// client_id: user.clientId,
|
|
495
|
+
// };
|
|
496
|
+
// await checklistLogs.create( logData );
|
|
497
497
|
|
|
498
498
|
let openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
499
499
|
// console.log( 'openSearch', openSearch );
|
|
@@ -1917,22 +1917,22 @@ export async function submitChecklist( req, res ) {
|
|
|
1917
1917
|
}
|
|
1918
1918
|
}
|
|
1919
1919
|
|
|
1920
|
-
let logInsertData = {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
};
|
|
1920
|
+
// let logInsertData = {
|
|
1921
|
+
// store_id: getchecklist[0].store_id || '',
|
|
1922
|
+
// storeName: getchecklist[0].storeName || '',
|
|
1923
|
+
// action: requestData?.submittype === 'draft' ? 'saved' : 'submitted',
|
|
1924
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
1925
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
1926
|
+
// checkListName: getchecklist[0].checkListName,
|
|
1927
|
+
// type: getchecklist[0].checkListType,
|
|
1928
|
+
// client_id: req.user.clientId,
|
|
1929
|
+
// redoStatus: requestData?.redoStatus ? true : false,
|
|
1930
|
+
// userEmail: getchecklist[0].userEmail || '',
|
|
1931
|
+
// userName: getchecklist[0].userName || '',
|
|
1932
|
+
// coverage: getchecklist[0].coverage || '',
|
|
1933
|
+
// };
|
|
1934
1934
|
// console.log( 'logInsertData=>', logInsertData );
|
|
1935
|
-
await checklistLogs.create( logInsertData );
|
|
1935
|
+
// await checklistLogs.create( logInsertData );
|
|
1936
1936
|
// let time = dayjs().format( 'HH:mm:ss' );
|
|
1937
1937
|
// let [ hours, minutes ] = time.split( ':' ).map( Number );
|
|
1938
1938
|
// let nearestMultipleOf10Minutes = Math.floor( minutes / 10 ) * 10;
|
|
@@ -2024,6 +2024,7 @@ export async function submitTask( req, res ) {
|
|
|
2024
2024
|
|
|
2025
2025
|
// eslint-disable-next-line camelcase
|
|
2026
2026
|
const { checklistStatus, storeName, userEmail, checkListName, store_id } = checklist;
|
|
2027
|
+
console.log( 'store_id =>', store_id );
|
|
2027
2028
|
|
|
2028
2029
|
if ( checklistStatus === 'open' ) {
|
|
2029
2030
|
return res.sendError( 'Checklist is in open status. Please start.', 400 );
|
|
@@ -2145,19 +2146,19 @@ export async function submitTask( req, res ) {
|
|
|
2145
2146
|
}
|
|
2146
2147
|
}
|
|
2147
2148
|
}
|
|
2148
|
-
const logInsertData = {
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
};
|
|
2160
|
-
await checklistLogs.create( logInsertData );
|
|
2149
|
+
// const logInsertData = {
|
|
2150
|
+
// // eslint-disable-next-line camelcase
|
|
2151
|
+
// store_id,
|
|
2152
|
+
// storeName,
|
|
2153
|
+
// action: submittype === 'draft' ? 'saved' : 'submitted',
|
|
2154
|
+
// checklistId: checklist.sourceCheckList_id,
|
|
2155
|
+
// processedChecklistId: checklist._id,
|
|
2156
|
+
// type: checklist.checkListType,
|
|
2157
|
+
// checkListName,
|
|
2158
|
+
// client_id: user.clientId,
|
|
2159
|
+
// redoStatus: requestData?.redoStatus ? true : false,
|
|
2160
|
+
// };
|
|
2161
|
+
// await checklistLogs.create( logInsertData );
|
|
2161
2162
|
|
|
2162
2163
|
if ( submittype == 'submit' ) {
|
|
2163
2164
|
updateOpenSearchTask( user, requestData );
|
|
@@ -2236,6 +2237,7 @@ export async function submiteyeTestTask( req, res ) {
|
|
|
2236
2237
|
|
|
2237
2238
|
// eslint-disable-next-line camelcase
|
|
2238
2239
|
const { checklistStatus, storeName, userEmail, checkListName, store_id } = checklist;
|
|
2240
|
+
console.log( 'store_id =>', store_id );
|
|
2239
2241
|
|
|
2240
2242
|
if ( checklistStatus === 'open' ) {
|
|
2241
2243
|
return res.sendError( 'Checklist is in open status. Please start.', 400 );
|
|
@@ -2357,19 +2359,19 @@ export async function submiteyeTestTask( req, res ) {
|
|
|
2357
2359
|
}
|
|
2358
2360
|
}
|
|
2359
2361
|
}
|
|
2360
|
-
const logInsertData = {
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
};
|
|
2372
|
-
await checklistLogs.create( logInsertData );
|
|
2362
|
+
// const logInsertData = {
|
|
2363
|
+
// // eslint-disable-next-line camelcase
|
|
2364
|
+
// store_id,
|
|
2365
|
+
// storeName,
|
|
2366
|
+
// action: submittype === 'draft' ? 'saved' : 'submitted',
|
|
2367
|
+
// checklistId: checklist.sourceCheckList_id,
|
|
2368
|
+
// processedChecklistId: checklist._id,
|
|
2369
|
+
// type: checklist.checkListType,
|
|
2370
|
+
// checkListName,
|
|
2371
|
+
// client_id: user.clientId,
|
|
2372
|
+
// redoStatus: requestData?.redoStatus ? true : false,
|
|
2373
|
+
// };
|
|
2374
|
+
// await checklistLogs.create( logInsertData );
|
|
2373
2375
|
|
|
2374
2376
|
if ( submittype == 'submit' ) {
|
|
2375
2377
|
updateOpenSearchTask( user, requestData );
|
|
@@ -2399,20 +2401,20 @@ async function updateOpenSearch( user, data ) {
|
|
|
2399
2401
|
|
|
2400
2402
|
let getchecklist = await processedchecklist.aggregate( findQuery );
|
|
2401
2403
|
if ( getchecklist.length ) {
|
|
2402
|
-
let logInsertData = {
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
};
|
|
2415
|
-
await checklistLogs.create( logInsertData );
|
|
2404
|
+
// let logInsertData = {
|
|
2405
|
+
// store_id: getchecklist[0].store_id,
|
|
2406
|
+
// storeName: getchecklist[0].storeName,
|
|
2407
|
+
// action: 'OpenSearch insert Triggered',
|
|
2408
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
2409
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
2410
|
+
// checkListName: getchecklist[0].checkListName,
|
|
2411
|
+
// type: getchecklist[0].checkListType,
|
|
2412
|
+
// client_id: user.clientId,
|
|
2413
|
+
// userEmail: getchecklist[0].userEmail || '',
|
|
2414
|
+
// userName: getchecklist[0].userName || '',
|
|
2415
|
+
// coverage: getchecklist[0].coverage || '',
|
|
2416
|
+
// };
|
|
2417
|
+
// await checklistLogs.create( logInsertData );
|
|
2416
2418
|
const requestOptions = {
|
|
2417
2419
|
method: 'POST',
|
|
2418
2420
|
headers: {
|
|
@@ -2423,20 +2425,20 @@ async function updateOpenSearch( user, data ) {
|
|
|
2423
2425
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2424
2426
|
let searchResponse = await fetch( url.submitChecklist, requestOptions );
|
|
2425
2427
|
if ( searchResponse.ok ) {
|
|
2426
|
-
let logInsertData = {
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
};
|
|
2439
|
-
await checklistLogs.create( logInsertData );
|
|
2428
|
+
// let logInsertData = {
|
|
2429
|
+
// store_id: getchecklist[0].store_id,
|
|
2430
|
+
// storeName: getchecklist[0].storeName,
|
|
2431
|
+
// action: 'OpenSearch inserted Successfully',
|
|
2432
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
2433
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
2434
|
+
// checkListName: getchecklist[0].checkListName,
|
|
2435
|
+
// type: getchecklist[0].checkListType,
|
|
2436
|
+
// client_id: user.clientId,
|
|
2437
|
+
// userEmail: getchecklist[0].userEmail || '',
|
|
2438
|
+
// userName: getchecklist[0].userName || '',
|
|
2439
|
+
// coverage: getchecklist[0].coverage || '',
|
|
2440
|
+
// };
|
|
2441
|
+
// await checklistLogs.create( logInsertData );
|
|
2440
2442
|
}
|
|
2441
2443
|
}
|
|
2442
2444
|
}
|
|
@@ -2454,20 +2456,20 @@ async function updateOpenSearchTask( user, data ) {
|
|
|
2454
2456
|
|
|
2455
2457
|
let getchecklist = await processedTask.aggregate( findQuery );
|
|
2456
2458
|
if ( getchecklist.length ) {
|
|
2457
|
-
let logInsertData = {
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
};
|
|
2470
|
-
await checklistLogs.create( logInsertData );
|
|
2459
|
+
// let logInsertData = {
|
|
2460
|
+
// store_id: getchecklist[0].store_id,
|
|
2461
|
+
// storeName: getchecklist[0].storeName,
|
|
2462
|
+
// action: 'OpenSearch insert Triggered',
|
|
2463
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
2464
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
2465
|
+
// checkListName: getchecklist[0].checkListName,
|
|
2466
|
+
// type: getchecklist[0].checkListType,
|
|
2467
|
+
// client_id: user.clientId,
|
|
2468
|
+
// userEmail: getchecklist[0].userEmail || '',
|
|
2469
|
+
// userName: getchecklist[0].userName || '',
|
|
2470
|
+
// coverage: getchecklist[0].coverage || '',
|
|
2471
|
+
// };
|
|
2472
|
+
// await checklistLogs.create( logInsertData );
|
|
2471
2473
|
const requestOptions = {
|
|
2472
2474
|
method: 'POST',
|
|
2473
2475
|
headers: {
|
|
@@ -2478,20 +2480,20 @@ async function updateOpenSearchTask( user, data ) {
|
|
|
2478
2480
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
2479
2481
|
let searchResponse = await fetch( url.submitTask, requestOptions );
|
|
2480
2482
|
if ( searchResponse.ok ) {
|
|
2481
|
-
let logInsertData = {
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
};
|
|
2494
|
-
await checklistLogs.create( logInsertData );
|
|
2483
|
+
// let logInsertData = {
|
|
2484
|
+
// store_id: getchecklist[0].store_id,
|
|
2485
|
+
// storeName: getchecklist[0].storeName,
|
|
2486
|
+
// action: 'OpenSearch inserted Successfully',
|
|
2487
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
2488
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
2489
|
+
// checkListName: getchecklist[0].checkListName,
|
|
2490
|
+
// type: getchecklist[0].checkListType,
|
|
2491
|
+
// client_id: user.clientId,
|
|
2492
|
+
// userEmail: getchecklist[0].userEmail || '',
|
|
2493
|
+
// userName: getchecklist[0].userName || '',
|
|
2494
|
+
// coverage: getchecklist[0].coverage || '',
|
|
2495
|
+
// };
|
|
2496
|
+
// await checklistLogs.create( logInsertData );
|
|
2495
2497
|
}
|
|
2496
2498
|
}
|
|
2497
2499
|
}
|
|
@@ -606,7 +606,7 @@ export const flagCardsV1 = async ( req, res ) => {
|
|
|
606
606
|
{
|
|
607
607
|
client_id: clientId,
|
|
608
608
|
publish: true,
|
|
609
|
-
checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking' ] },
|
|
609
|
+
checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] },
|
|
610
610
|
},
|
|
611
611
|
{ checkListType: 1 },
|
|
612
612
|
);
|
|
@@ -2584,7 +2584,6 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2584
2584
|
// let LamdaURL = 'https://vpcejaftccr3jzqf5wrdkks7yy0krqix.lambda-url.ap-south-1.on.aws/'; // Prod
|
|
2585
2585
|
let LamdaURL = url.flagChecklistTableV1; // test
|
|
2586
2586
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
2587
|
-
// console.log( 'resultData =>', resultData );
|
|
2588
2587
|
if ( resultData ) {
|
|
2589
2588
|
if ( resultData.status_code == '200' ) {
|
|
2590
2589
|
if ( reqestData?.filter === 'runAI' ) {
|
|
@@ -2739,7 +2738,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2739
2738
|
$or: [
|
|
2740
2739
|
{ questionFlag: { $gte: 1 } },
|
|
2741
2740
|
{ timeFlag: { $gte: 1 } },
|
|
2742
|
-
{ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking' ] } },
|
|
2741
|
+
{ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] } },
|
|
2743
2742
|
{
|
|
2744
2743
|
runAIQuestionCount: { $gte: 1 },
|
|
2745
2744
|
},
|
|
@@ -2941,7 +2940,7 @@ export const flagComparisonCardsV2 = async ( req, res ) => {
|
|
|
2941
2940
|
{
|
|
2942
2941
|
client_id: requestData.clientId,
|
|
2943
2942
|
publish: true,
|
|
2944
|
-
checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking' ] },
|
|
2943
|
+
checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] },
|
|
2945
2944
|
},
|
|
2946
2945
|
{ checkListType: 1 },
|
|
2947
2946
|
);
|
|
@@ -3033,7 +3032,8 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3033
3032
|
);
|
|
3034
3033
|
if ( requestData.clientId == '11' ) {
|
|
3035
3034
|
findAndQuery.push(
|
|
3036
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
3035
|
+
// { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
3036
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ] },
|
|
3037
3037
|
);
|
|
3038
3038
|
} else {
|
|
3039
3039
|
findAndQuery.push(
|
|
@@ -3042,7 +3042,7 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3042
3042
|
}
|
|
3043
3043
|
|
|
3044
3044
|
if ( requestData?.filter === 'all' ) {
|
|
3045
|
-
findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking' ] } } ] } );
|
|
3045
|
+
findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] } } ] } );
|
|
3046
3046
|
} else if ( requestData?.filter === 'question' ) {
|
|
3047
3047
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
3048
3048
|
findAndQuery.push( { questionFlag: { $gte: 1 } } );
|
|
@@ -3050,7 +3050,7 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3050
3050
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
3051
3051
|
findAndQuery.push( { timeFlag: { $gte: 1 } } );
|
|
3052
3052
|
} else if ( requestData?.filter === 'detection' ) {
|
|
3053
|
-
findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking' ] } } );
|
|
3053
|
+
findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection', 'cleaning', 'scrum', 'outsidebusinesshoursqueuetracking', 'halfshutter' ] } } );
|
|
3054
3054
|
} else if ( requestData?.filter === 'runAI' ) {
|
|
3055
3055
|
if ( req.body.runAIChecklistName ) {
|
|
3056
3056
|
findAndQuery.push( { checkListName: { $in: req.body.runAIChecklistName } } );
|
|
@@ -3239,7 +3239,8 @@ export const flagTablesV2 = async ( req, res ) => {
|
|
|
3239
3239
|
} else {
|
|
3240
3240
|
if ( requestData?.filter == 'all' ) {
|
|
3241
3241
|
getChecklistPerformanceData[index].runAIFlag = 0;
|
|
3242
|
-
getChecklistPerformanceData[index].
|
|
3242
|
+
getChecklistPerformanceData[index].flagCount = resultData?.[getChecklistPerformanceData[index]?.checkListType] || 0;
|
|
3243
|
+
getChecklistPerformanceData[index].flaggedStores = resultData?.[`${getChecklistPerformanceData[index]?.checkListType}_flaggedstores`] || 0;
|
|
3243
3244
|
} else {
|
|
3244
3245
|
getChecklistPerformanceData[index].flagCount = 0;
|
|
3245
3246
|
getChecklistPerformanceData[index].flaggedStores = 0;
|
|
@@ -10,7 +10,7 @@ import * as storeService from '../services/store.service.js';
|
|
|
10
10
|
import mongoose from 'mongoose';
|
|
11
11
|
import * as processedchecklistConfig from '../services/processedchecklistconfig.services.js';
|
|
12
12
|
import * as processedchecklist from '../services/processedchecklist.services.js';
|
|
13
|
-
import * as checklistLogs from '../services/checklistlog.service.js';
|
|
13
|
+
// import * as checklistLogs from '../services/checklistlog.service.js';
|
|
14
14
|
import * as tagService from '../services/tagging.service.js';
|
|
15
15
|
import * as alertsServices from '../services/clientRequest.service.js';
|
|
16
16
|
import * as traxApprover from '../services/approver.service.js';
|
|
@@ -25,6 +25,7 @@ import * as clusterServices from '../services/cluster.service.js';
|
|
|
25
25
|
import * as teamsServices from '../services/teams.service.js';
|
|
26
26
|
import * as runAIFeatureServices from '../services/runAIFeatures.services.js';
|
|
27
27
|
import * as runAIRequestServices from '../services/runAIRequest.services.js';
|
|
28
|
+
import * as processedTaskService from '../services/processedTaskList.service.js';
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
export const checklist = async ( req, res ) => {
|
|
@@ -215,17 +216,17 @@ export const create = async ( req, res ) => {
|
|
|
215
216
|
|
|
216
217
|
await checklistService.create( checkListDetails ).then( async ( data ) => {
|
|
217
218
|
checkListId = data._id;
|
|
218
|
-
let logInsertData = {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
};
|
|
228
|
-
await checklistLogs.create( logInsertData );
|
|
219
|
+
// let logInsertData = {
|
|
220
|
+
// action: 'checklistCreate',
|
|
221
|
+
// checklistId: checkListId,
|
|
222
|
+
// checkListName: inputBody.checklistName,
|
|
223
|
+
// createdBy: req.user._id,
|
|
224
|
+
// createdByName: req.user.userName,
|
|
225
|
+
// client_id: req.body.clientId,
|
|
226
|
+
// sections: inputBody?.sections,
|
|
227
|
+
// createdByEmail: req.user.email,
|
|
228
|
+
// };
|
|
229
|
+
// await checklistLogs.create( logInsertData );
|
|
229
230
|
if ( inputBody.sections.length ) {
|
|
230
231
|
for ( let i = 0; i < inputBody?.sections?.length; i++ ) {
|
|
231
232
|
let section = inputBody.sections[i];
|
|
@@ -591,7 +592,13 @@ export const zoneList = async ( req, res ) => {
|
|
|
591
592
|
try {
|
|
592
593
|
let inputBody = req.query;
|
|
593
594
|
|
|
594
|
-
|
|
595
|
+
const allowedChecklists = [
|
|
596
|
+
'Outside Business Hours Queue Tracking',
|
|
597
|
+
'Store Half Shutter Detection',
|
|
598
|
+
'Mobile usage detection',
|
|
599
|
+
];
|
|
600
|
+
|
|
601
|
+
if ( inputBody.checkListName && allowedChecklists.includes( inputBody.checkListName ) ) {
|
|
595
602
|
let query = [
|
|
596
603
|
{
|
|
597
604
|
$match: {
|
|
@@ -751,16 +758,16 @@ export const deleteChecklist = async ( req, res ) => {
|
|
|
751
758
|
}
|
|
752
759
|
|
|
753
760
|
checklistDetails.isdeleted = true;
|
|
754
|
-
let logInsertData = {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
};
|
|
763
|
-
await checklistLogs.create( logInsertData );
|
|
761
|
+
// let logInsertData = {
|
|
762
|
+
// action: 'deleteChecklist',
|
|
763
|
+
// checklistId: req.params.checklistId,
|
|
764
|
+
// checkListName: checklistDetails.checkListName,
|
|
765
|
+
// createdBy: req.user._id,
|
|
766
|
+
// createdByName: req.user.userName,
|
|
767
|
+
// client_id: req.user?.clientId || checklistDetails?.client_id,
|
|
768
|
+
// createdByEmail: req.user.email,
|
|
769
|
+
// };
|
|
770
|
+
// await checklistLogs.create( logInsertData );
|
|
764
771
|
// await checklistService.updateMany( { type: 'section', checkListId: req.params.checklistId }, { isdeleted: true } );
|
|
765
772
|
await questionService.updateMany( { checkListId: req.params.checklistId }, { isdeleted: true } );
|
|
766
773
|
await assignedService.updateMany( { checkListId: req.params.checklistId }, { isdeleted: true } );
|
|
@@ -830,16 +837,16 @@ export const duplicateChecklist = async ( req, res ) => {
|
|
|
830
837
|
dupDetails.publishDate = '';
|
|
831
838
|
dupDetails.checkListNumber = dupDetails.checkListNumber+1;
|
|
832
839
|
delete dupDetails._id;
|
|
833
|
-
let logInsertData = {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
};
|
|
842
|
-
await checklistLogs.create( logInsertData );
|
|
840
|
+
// let logInsertData = {
|
|
841
|
+
// action: 'duplicateChecklist',
|
|
842
|
+
// checklistId: req.params.checklistId,
|
|
843
|
+
// checkListName: checkDetails.checkListName,
|
|
844
|
+
// createdBy: req.user._id,
|
|
845
|
+
// createdByName: req.user.userName,
|
|
846
|
+
// client_id: req.query.clientId,
|
|
847
|
+
// createdByEmail: req.user.email,
|
|
848
|
+
// };
|
|
849
|
+
// await checklistLogs.create( logInsertData );
|
|
843
850
|
checklistService.create( dupDetails ).then( async ( data ) => {
|
|
844
851
|
let userList = await assignedService.find( { checkListId: checkDetails._id, client_id: req.query.clientId } );
|
|
845
852
|
if ( userList.length ) {
|
|
@@ -963,17 +970,17 @@ export const update = async ( req, res ) => {
|
|
|
963
970
|
|
|
964
971
|
await checklistService.updateOne( { _id: req.params.checklistId }, params );
|
|
965
972
|
let checkListId = req.params.checklistId;
|
|
966
|
-
let logInsertData = {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
};
|
|
976
|
-
await checklistLogs.create( logInsertData );
|
|
973
|
+
// let logInsertData = {
|
|
974
|
+
// action: 'checklistUpdate',
|
|
975
|
+
// checklistId: checkListId,
|
|
976
|
+
// checkListName: inputBody.checklistName,
|
|
977
|
+
// createdBy: req.user._id,
|
|
978
|
+
// createdByName: req.user.userName,
|
|
979
|
+
// client_id: req.body.clientId,
|
|
980
|
+
// sections: inputBody?.sections,
|
|
981
|
+
// createdByEmail: req.user.email,
|
|
982
|
+
// };
|
|
983
|
+
// await checklistLogs.create( logInsertData );
|
|
977
984
|
let sectionList =[];
|
|
978
985
|
if ( inputBody.sections.length ) {
|
|
979
986
|
for ( let i = 0; i < inputBody?.sections?.length; i++ ) {
|
|
@@ -1579,17 +1586,17 @@ export const updateConfigure =async ( req, res ) => {
|
|
|
1579
1586
|
}
|
|
1580
1587
|
|
|
1581
1588
|
|
|
1582
|
-
let logInsertData = {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
};
|
|
1592
|
-
await checklistLogs.create( logInsertData );
|
|
1589
|
+
// let logInsertData = {
|
|
1590
|
+
// action: inputBody.submitType == 'publish' ? 'checklistPublishUsingConfigPage' : 'checklistConfigDraft',
|
|
1591
|
+
// checklistId: inputBody.checkListDetails._id,
|
|
1592
|
+
// checkListName: inputBody?.checkListDetails.checkListName,
|
|
1593
|
+
// createdBy: req.user._id,
|
|
1594
|
+
// createdByName: req.user.userName,
|
|
1595
|
+
// client_id: req.body.clientId,
|
|
1596
|
+
// createdByEmail: req.user.email,
|
|
1597
|
+
// approver: inputBody?.checkListDetails?.approver || [],
|
|
1598
|
+
// };
|
|
1599
|
+
// await checklistLogs.create( logInsertData );
|
|
1593
1600
|
|
|
1594
1601
|
checklistDetails = await checklistService.findOne( { _id: inputBody.checkListDetails._id, type: 'checklist', isdeleted: false } );
|
|
1595
1602
|
|
|
@@ -1868,18 +1875,18 @@ export const updateConfigurev1 =async ( req, res ) => {
|
|
|
1868
1875
|
}
|
|
1869
1876
|
|
|
1870
1877
|
|
|
1871
|
-
let logInsertData = {
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
};
|
|
1882
|
-
await checklistLogs.create( logInsertData );
|
|
1878
|
+
// let logInsertData = {
|
|
1879
|
+
// action: inputBody.submitType == 'publish' ? 'checklistPublishUsingConfigPage' : 'checklistConfigDraft',
|
|
1880
|
+
// checklistId: inputBody.checkListDetails._id,
|
|
1881
|
+
// checkListName: inputBody?.checkListDetails.checkListName,
|
|
1882
|
+
// createdBy: req.user._id,
|
|
1883
|
+
// createdByName: req.user.userName,
|
|
1884
|
+
// client_id: req.body.clientId,
|
|
1885
|
+
// createdByEmail: req.user.email,
|
|
1886
|
+
// approver: inputBody?.checkListDetails?.approver || [],
|
|
1887
|
+
// sections: inputBody?.checkListDetails?.sections || [],
|
|
1888
|
+
// };
|
|
1889
|
+
// await checklistLogs.create( logInsertData );
|
|
1883
1890
|
|
|
1884
1891
|
checklistDetails = await checklistService.findOne( { _id: inputBody.checkListDetails._id, type: 'checklist', isdeleted: false } );
|
|
1885
1892
|
let oldPublish = checklistDetails.publish;
|
|
@@ -2329,10 +2336,10 @@ export const updatePublish = async ( req, res ) => {
|
|
|
2329
2336
|
await processedchecklist.deleteMany( deleteQuery );
|
|
2330
2337
|
logger.info( { function: 'updatePublish', query: deleteQuery } );
|
|
2331
2338
|
|
|
2332
|
-
let checklistLogQuery = {};
|
|
2333
|
-
checklistLogQuery.checkListName = getCheckDetails.checkListName;
|
|
2334
|
-
checklistLogQuery.createdAt = { $gte: new Date( dayjs().format( 'YYYY-MM-DD' ) ) };
|
|
2335
|
-
await checklistLogs.deleteMany( checklistLogQuery );
|
|
2339
|
+
// let checklistLogQuery = {};
|
|
2340
|
+
// checklistLogQuery.checkListName = getCheckDetails.checkListName;
|
|
2341
|
+
// checklistLogQuery.createdAt = { $gte: new Date( dayjs().format( 'YYYY-MM-DD' ) ) };
|
|
2342
|
+
// await checklistLogs.deleteMany( checklistLogQuery );
|
|
2336
2343
|
|
|
2337
2344
|
let checklistDetectionsQuery = {};
|
|
2338
2345
|
checklistDetectionsQuery.sourceChecklist_id = new ObjectId( req.body.checklistId );
|
|
@@ -2347,16 +2354,16 @@ export const updatePublish = async ( req, res ) => {
|
|
|
2347
2354
|
futureDaysDataRemove( currentDate, req.body.checklistId, getCheckDetails.checkListName, '222' );
|
|
2348
2355
|
}
|
|
2349
2356
|
}
|
|
2350
|
-
let logInsertData = {
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
};
|
|
2359
|
-
await checklistLogs.create( logInsertData );
|
|
2357
|
+
// let logInsertData = {
|
|
2358
|
+
// action: req.body.publish ? 'publishChecklist' : 'unPublishChecklist',
|
|
2359
|
+
// ...( req.body?.checklistId ) ? { checklistId: req.body?.checklistId } : { type: req.body?.type },
|
|
2360
|
+
// checkListName: getCheckDetails.checkListName,
|
|
2361
|
+
// createdBy: req.user._id,
|
|
2362
|
+
// createdByName: req.user.userName,
|
|
2363
|
+
// client_id: req.body.clientId,
|
|
2364
|
+
// createdByEmail: req.user.email,
|
|
2365
|
+
// };
|
|
2366
|
+
// await checklistLogs.create( logInsertData );
|
|
2360
2367
|
let actionType;
|
|
2361
2368
|
let teamsMsg;
|
|
2362
2369
|
actionType = req.body.publish ? 'publish' : 'unpublish';
|
|
@@ -3998,17 +4005,17 @@ async function updateOpenSearch( user, data ) {
|
|
|
3998
4005
|
|
|
3999
4006
|
let getchecklist = await processedchecklist.aggregate( findQuery );
|
|
4000
4007
|
if ( getchecklist.length ) {
|
|
4001
|
-
let logInsertData = {
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
};
|
|
4011
|
-
await checklistLogs.create( logInsertData );
|
|
4008
|
+
// let logInsertData = {
|
|
4009
|
+
// store_id: getchecklist[0].store_id,
|
|
4010
|
+
// storeName: getchecklist[0].storeName,
|
|
4011
|
+
// action: 'Republish OpenSearch insert Triggered',
|
|
4012
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
4013
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
4014
|
+
// checkListName: getchecklist[0].checkListName,
|
|
4015
|
+
// type: getchecklist[0].checkListType,
|
|
4016
|
+
// client_id: user.clientId,
|
|
4017
|
+
// };
|
|
4018
|
+
// await checklistLogs.create( logInsertData );
|
|
4012
4019
|
const requestOptions = {
|
|
4013
4020
|
method: 'POST',
|
|
4014
4021
|
headers: {
|
|
@@ -4019,17 +4026,17 @@ async function updateOpenSearch( user, data ) {
|
|
|
4019
4026
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
4020
4027
|
let searchResponse = await fetch( url.submitChecklist, requestOptions );
|
|
4021
4028
|
if ( searchResponse.ok ) {
|
|
4022
|
-
let logInsertData = {
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
};
|
|
4032
|
-
await checklistLogs.create( logInsertData );
|
|
4029
|
+
// let logInsertData = {
|
|
4030
|
+
// store_id: getchecklist[0].store_id,
|
|
4031
|
+
// storeName: getchecklist[0].storeName,
|
|
4032
|
+
// action: 'Republish OpenSearch inserted Successfully',
|
|
4033
|
+
// checklistId: getchecklist[0].sourceCheckList_id,
|
|
4034
|
+
// processedChecklistId: getchecklist[0]._id,
|
|
4035
|
+
// checkListName: getchecklist[0].checkListName,
|
|
4036
|
+
// type: getchecklist[0].checkListType,
|
|
4037
|
+
// client_id: user.clientId,
|
|
4038
|
+
// };
|
|
4039
|
+
// await checklistLogs.create( logInsertData );
|
|
4033
4040
|
}
|
|
4034
4041
|
}
|
|
4035
4042
|
}
|
|
@@ -4037,7 +4044,7 @@ async function updateOpenSearch( user, data ) {
|
|
|
4037
4044
|
export const aiChecklist = async ( req, res ) => {
|
|
4038
4045
|
try {
|
|
4039
4046
|
let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
|
|
4040
|
-
let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking' ];
|
|
4047
|
+
let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'queuealert', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter' ];
|
|
4041
4048
|
let checklistDetails = [];
|
|
4042
4049
|
let publishList = [];
|
|
4043
4050
|
let unpublishList = [];
|
|
@@ -4050,7 +4057,7 @@ export const aiChecklist = async ( req, res ) => {
|
|
|
4050
4057
|
checklistDetails = [ ...publishList, ...unpublishList ];
|
|
4051
4058
|
|
|
4052
4059
|
checklistDetails.forEach( ( item ) => {
|
|
4053
|
-
if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking' ].includes( item.checkListType ) ) {
|
|
4060
|
+
if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter' ].includes( item.checkListType ) ) {
|
|
4054
4061
|
item.storeCount = storeDetails;
|
|
4055
4062
|
}
|
|
4056
4063
|
} );
|
|
@@ -4956,3 +4963,53 @@ export async function updateRunAIFeatures( req, res ) {
|
|
|
4956
4963
|
return res.sendError( error, 500 );
|
|
4957
4964
|
}
|
|
4958
4965
|
}
|
|
4966
|
+
|
|
4967
|
+
|
|
4968
|
+
export async function updateOSProcessedData( req, res ) {
|
|
4969
|
+
try {
|
|
4970
|
+
let requestData = req.body;
|
|
4971
|
+
let findQuery = [ {
|
|
4972
|
+
$match: {
|
|
4973
|
+
$and: [
|
|
4974
|
+
{ _id: new ObjectId( requestData._id ) },
|
|
4975
|
+
],
|
|
4976
|
+
},
|
|
4977
|
+
} ];
|
|
4978
|
+
if ( requestData.type && requestData.type=='checklist' ) {
|
|
4979
|
+
let getchecklist = await processedchecklist.aggregate( findQuery );
|
|
4980
|
+
if ( getchecklist && getchecklist.length > 0 ) {
|
|
4981
|
+
const requestOptions = {
|
|
4982
|
+
method: 'POST',
|
|
4983
|
+
headers: {
|
|
4984
|
+
'Content-Type': 'application/json',
|
|
4985
|
+
},
|
|
4986
|
+
body: JSON.stringify( { doc: { ...getchecklist[0] } } ),
|
|
4987
|
+
};
|
|
4988
|
+
let url = JSON.parse( process.env.LAMBDAURL );
|
|
4989
|
+
let searchResponse = await fetch( url.submitChecklist, requestOptions );
|
|
4990
|
+
return res.sendSuccess( searchResponse );
|
|
4991
|
+
} else {
|
|
4992
|
+
return res.sendError( { message: 'invalid _id' }, 400 );
|
|
4993
|
+
}
|
|
4994
|
+
} else if ( requestData.type && requestData.type=='task' ) {
|
|
4995
|
+
let gettask = await processedTaskService.aggregate( findQuery );
|
|
4996
|
+
if ( gettask && gettask.length > 0 ) {
|
|
4997
|
+
const requestOptions = {
|
|
4998
|
+
method: 'POST',
|
|
4999
|
+
headers: {
|
|
5000
|
+
'Content-Type': 'application/json',
|
|
5001
|
+
},
|
|
5002
|
+
body: JSON.stringify( { doc: { ...gettask[0] } } ),
|
|
5003
|
+
};
|
|
5004
|
+
let url = JSON.parse( process.env.LAMBDAURL );
|
|
5005
|
+
let searchResponse = await fetch( url.submitTask, requestOptions );
|
|
5006
|
+
return res.sendSuccess( searchResponse );
|
|
5007
|
+
} else {
|
|
5008
|
+
return res.sendError( { message: 'invalid _id' }, 400 );
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
} catch ( e ) {
|
|
5012
|
+
logger.error( { functionName: 'updateCurlData', error: e } );
|
|
5013
|
+
return res.sendError( error, 500 );
|
|
5014
|
+
}
|
|
5015
|
+
}
|
|
@@ -11,6 +11,12 @@ export const checklistSchema = joi.object( {
|
|
|
11
11
|
export const checklistValidation = {
|
|
12
12
|
body: checklistSchema,
|
|
13
13
|
};
|
|
14
|
+
export const validateHeaderSchema = joi.object( {
|
|
15
|
+
clientId: joi.string().required().allow( '' ),
|
|
16
|
+
city: joi.array().required(),
|
|
17
|
+
group: joi.array().required(),
|
|
18
|
+
country: joi.array().optional().empty(),
|
|
19
|
+
} );
|
|
14
20
|
export const validateHeaderSchemav2 = joi.object( {
|
|
15
21
|
clientId: joi.string().required(),
|
|
16
22
|
city: joi.array().required(),
|
|
@@ -19,7 +25,9 @@ export const validateHeaderSchemav2 = joi.object( {
|
|
|
19
25
|
export const validateHeaderParamsv2 = {
|
|
20
26
|
body: validateHeaderSchemav2,
|
|
21
27
|
};
|
|
22
|
-
|
|
28
|
+
export const validateHeaderParams = {
|
|
29
|
+
body: validateHeaderSchema,
|
|
30
|
+
};
|
|
23
31
|
|
|
24
32
|
export const checklistDetailsSchema = joi.object( {
|
|
25
33
|
checkListId: joi.string().optional(),
|
|
@@ -185,4 +193,11 @@ export const runAIRequestValidation = {
|
|
|
185
193
|
body: runAIRequestSchema,
|
|
186
194
|
};
|
|
187
195
|
|
|
196
|
+
export const updateOSDataSchema = joi.object( {
|
|
197
|
+
_id: joi.string().required(),
|
|
198
|
+
type: joi.string().required(),
|
|
199
|
+
} );
|
|
188
200
|
|
|
201
|
+
export const updateOSDataValidation = {
|
|
202
|
+
body: updateOSDataSchema,
|
|
203
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist,
|
|
4
4
|
storesList, checklistDropdown, redoChecklist, redomultiChecklist, approveChecklist,
|
|
5
|
-
approvalstatus, allapprovalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate, taskvalidateUserData, getallchecklist, exportTemplate } from '../controllers/gallery.controller.js';
|
|
5
|
+
approvalstatus, allapprovalstatus, getLogs, headerStoresV2, headerClustersV2, headerLocationsV2, teamsList, userList, checkNotificationCount, vehicleCheckInUpdate, taskvalidateUserData, getallchecklist, exportTemplate } from '../controllers/gallery.controller.js';
|
|
6
6
|
import express from 'express';
|
|
7
7
|
export const galleryRouter = express.Router();
|
|
8
8
|
import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
|
|
@@ -31,6 +31,8 @@ galleryRouter
|
|
|
31
31
|
.post( '/allapprovalstatus', isAllowedSessionHandler, allapprovalstatus )
|
|
32
32
|
.post( '/getLogs', isAllowedSessionHandler, getLogs )
|
|
33
33
|
.post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
|
|
34
|
+
.post( '/headercluster_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), getAssinedStore, headerClustersV2 )
|
|
35
|
+
.post( '/headerLocations_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), getAssinedStore, headerLocationsV2 )
|
|
34
36
|
.get( '/teamsList', isAllowedSessionHandler, isAllowedClient, teamsList )
|
|
35
37
|
.post( '/userList', isAllowedSessionHandler, isAllowedClient, userList )
|
|
36
38
|
.post( '/taskvalidateUserData', isAllowedSessionHandler, isAllowedClient, taskvalidateUserData )
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient } from 'tango-app-api-middleware';
|
|
3
|
-
import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation, aichecklistValidation, publishValidation, selectAssign, createChecklistNameValidation, runAIRequestValidation } from '../dtos/validation.dtos.js';
|
|
2
|
+
import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient, isAllowedInternalAPIHandler } from 'tango-app-api-middleware';
|
|
3
|
+
import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation, aichecklistValidation, publishValidation, selectAssign, createChecklistNameValidation, runAIRequestValidation, updateOSDataValidation } from '../dtos/validation.dtos.js';
|
|
4
4
|
import * as traxController from '../controllers/trax.controller.js';
|
|
5
5
|
|
|
6
6
|
export const traxRouter = express.Router();
|
|
@@ -34,6 +34,7 @@ traxRouter
|
|
|
34
34
|
.post( '/getRunAIFeatures', isAllowedSessionHandler, traxController.getRunAIFeatures )
|
|
35
35
|
.post( '/updateRunAIFeatures', isAllowedSessionHandler, traxController.updateRunAIFeatures )
|
|
36
36
|
.post( '/updateRunAIRequest', isAllowedSessionHandler, validate( runAIRequestValidation ), traxController.updateRunAIRequest )
|
|
37
|
-
.post( '/createChecklistName', isAllowedSessionHandler, validate( createChecklistNameValidation ), traxController.createChecklistName )
|
|
37
|
+
.post( '/createChecklistName', isAllowedSessionHandler, validate( createChecklistNameValidation ), traxController.createChecklistName )
|
|
38
|
+
.post( '/updateOSProcessedData', isAllowedInternalAPIHandler, validate( updateOSDataValidation ), traxController.updateOSProcessedData );
|
|
38
39
|
|
|
39
40
|
// isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ),
|