tango-app-api-trax 3.6.0-sec-1 → 3.6.0-sec-2
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 +2 -2
- package/src/controllers/gallery.controller.js +43 -24
- package/src/controllers/internalTrax.controller.js +118 -1
- package/src/controllers/mobileTrax.controller.js +34 -0
- package/src/routes/gallery.routes.js +8 -8
- package/src/routes/internalTraxApi.router.js +2 -1
- package/src/routes/mobileTrax.routes.js +1 -0
- package/src/services/notification.service.js +31 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-trax",
|
|
3
|
-
"version": "3.6.0-sec-
|
|
3
|
+
"version": "3.6.0-sec-2",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mongodb": "^6.8.0",
|
|
27
27
|
"nodemon": "^3.1.4",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"tango-api-schema": "^2.2.
|
|
29
|
+
"tango-api-schema": "^2.2.142",
|
|
30
30
|
"tango-app-api-middleware": "^3.1.77",
|
|
31
31
|
"url": "^0.11.4",
|
|
32
32
|
"winston": "^3.13.1",
|
|
@@ -16,6 +16,7 @@ import { aggregate } from '../services/user.service.js';
|
|
|
16
16
|
// import axios from 'axios';
|
|
17
17
|
import timeZone from 'dayjs/plugin/timezone.js';
|
|
18
18
|
import customParseFormat from 'dayjs/plugin/customParseFormat.js';
|
|
19
|
+
import * as notificationModel from '../services/notification.service.js';
|
|
19
20
|
|
|
20
21
|
dayjs.extend( customParseFormat );
|
|
21
22
|
dayjs.extend( timeZone );
|
|
@@ -483,8 +484,8 @@ export async function redoChecklist( req, res ) {
|
|
|
483
484
|
sectionName: question[sectionIndex].sectionName,
|
|
484
485
|
questionName: question[sectionIndex].questions[findQuestion].qname,
|
|
485
486
|
action: 'redo',
|
|
486
|
-
store_id: checklistDetails?.store_id?checklistDetails?.store_id:'',
|
|
487
|
-
storeName: checklistDetails?.storeName?checklistDetails?.storeName:'',
|
|
487
|
+
store_id: checklistDetails?.store_id ? checklistDetails?.store_id : '',
|
|
488
|
+
storeName: checklistDetails?.storeName ? checklistDetails?.storeName : '',
|
|
488
489
|
client_id: checklistDetails.client_id,
|
|
489
490
|
processedChecklistId: checklistDetails._id,
|
|
490
491
|
type: checklistDetails.checkListType,
|
|
@@ -507,16 +508,16 @@ export async function redoChecklist( req, res ) {
|
|
|
507
508
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
508
509
|
let searchResponse = await fetch( url.redoChecklist, requestOptions );
|
|
509
510
|
// console.log( searchResponse.ok );
|
|
510
|
-
let logData= {
|
|
511
|
+
let logData = {
|
|
511
512
|
'client_id': checklistDetails.client_id,
|
|
512
513
|
'createAt': new Date(),
|
|
513
514
|
'sourceCheckList_id': checklistDetails.sourceCheckList_id,
|
|
514
515
|
'checkListName': checklistDetails.checkListName,
|
|
515
516
|
'fromCheckListName': checklistDetails.checkListName,
|
|
516
517
|
'type': 'checklist',
|
|
517
|
-
'action': checklistDetails.redoStatus?'multiredo': 'redo',
|
|
518
|
-
'storeName': checklistDetails?.storeName?checklistDetails?.storeName:'',
|
|
519
|
-
'store_id': checklistDetails?.store_id?checklistDetails?.store_id:'',
|
|
518
|
+
'action': checklistDetails.redoStatus ? 'multiredo' : 'redo',
|
|
519
|
+
'storeName': checklistDetails?.storeName ? checklistDetails?.storeName : '',
|
|
520
|
+
'store_id': checklistDetails?.store_id ? checklistDetails?.store_id : '',
|
|
520
521
|
'userName': checklistDetails.userName,
|
|
521
522
|
'userEmail': checklistDetails.userEmail,
|
|
522
523
|
'createdByEmail': req.user.email,
|
|
@@ -544,7 +545,7 @@ export async function redoChecklist( req, res ) {
|
|
|
544
545
|
|
|
545
546
|
export async function redomultiChecklist( req, res ) {
|
|
546
547
|
try {
|
|
547
|
-
let inputData = req.body.payload.coverage==='user'?req.body.payload.userEmail:req.body.payload.storeName;
|
|
548
|
+
let inputData = req.body.payload.coverage === 'user' ? req.body.payload.userEmail : req.body.payload.storeName;
|
|
548
549
|
|
|
549
550
|
|
|
550
551
|
for ( let originalData of inputData ) {
|
|
@@ -625,8 +626,8 @@ export async function redomultiChecklist( req, res ) {
|
|
|
625
626
|
sectionName: question[sectionIndex].sectionName,
|
|
626
627
|
questionName: question[sectionIndex].questions[findQuestion].qname,
|
|
627
628
|
action: 'redo',
|
|
628
|
-
store_id: checklistDetails?.store_id?checklistDetails?.store_id:'',
|
|
629
|
-
storeName: checklistDetails?.storeName?checklistDetails?.storeName:'',
|
|
629
|
+
store_id: checklistDetails?.store_id ? checklistDetails?.store_id : '',
|
|
630
|
+
storeName: checklistDetails?.storeName ? checklistDetails?.storeName : '',
|
|
630
631
|
client_id: checklistDetails.client_id,
|
|
631
632
|
processedChecklistId: checklistDetails._id,
|
|
632
633
|
type: checklistDetails.checkListType,
|
|
@@ -640,9 +641,9 @@ export async function redomultiChecklist( req, res ) {
|
|
|
640
641
|
await checklistLogs.create( data );
|
|
641
642
|
|
|
642
643
|
|
|
643
|
-
req.body.payload._id=originalData.checklistId;
|
|
644
|
-
req.body.payload.section_id=originalData.section_id;
|
|
645
|
-
req.body.payload.uniqueNo=originalData.uniqueNo;
|
|
644
|
+
req.body.payload._id = originalData.checklistId;
|
|
645
|
+
req.body.payload.section_id = originalData.section_id;
|
|
646
|
+
req.body.payload.uniqueNo = originalData.uniqueNo;
|
|
646
647
|
// console.log( req.body );
|
|
647
648
|
|
|
648
649
|
|
|
@@ -656,16 +657,16 @@ export async function redomultiChecklist( req, res ) {
|
|
|
656
657
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
657
658
|
let searchResponse = await fetch( url.redoChecklist, requestOptions );
|
|
658
659
|
console.log( searchResponse.ok );
|
|
659
|
-
let logData= {
|
|
660
|
+
let logData = {
|
|
660
661
|
'client_id': checklistDetails.client_id,
|
|
661
662
|
'createAt': new Date(),
|
|
662
663
|
'sourceCheckList_id': checklistDetails.sourceCheckList_id,
|
|
663
664
|
'checkListName': checklistDetails.checkListName,
|
|
664
665
|
'fromCheckListName': checklistDetails.checkListName,
|
|
665
666
|
'type': 'checklist',
|
|
666
|
-
'action': checklistDetails.redoStatus?'multiredo': 'redo',
|
|
667
|
-
'storeName': checklistDetails?.storeName?checklistDetails?.storeName:'',
|
|
668
|
-
'store_id': checklistDetails?.store_id?checklistDetails?.store_id:'',
|
|
667
|
+
'action': checklistDetails.redoStatus ? 'multiredo' : 'redo',
|
|
668
|
+
'storeName': checklistDetails?.storeName ? checklistDetails?.storeName : '',
|
|
669
|
+
'store_id': checklistDetails?.store_id ? checklistDetails?.store_id : '',
|
|
669
670
|
'userName': checklistDetails.userName,
|
|
670
671
|
'userEmail': checklistDetails.userEmail,
|
|
671
672
|
'createdByEmail': req.user.email,
|
|
@@ -769,6 +770,7 @@ export async function approvalstatus( req, res ) {
|
|
|
769
770
|
export const headerStoresV2 = async ( req, res ) => {
|
|
770
771
|
try {
|
|
771
772
|
let reqestData = req.body;
|
|
773
|
+
|
|
772
774
|
let getUserEmail = req.user.email;
|
|
773
775
|
let getUserType = req.user.userType;
|
|
774
776
|
let getRole = req.user.role;
|
|
@@ -1048,7 +1050,7 @@ export async function teamsList( req, res ) {
|
|
|
1048
1050
|
];
|
|
1049
1051
|
|
|
1050
1052
|
|
|
1051
|
-
if ( req.user&&req.user.userType==='client'&&req.user.role!='superadmin' ) {
|
|
1053
|
+
if ( req.user && req.user.userType === 'client' && req.user.role != 'superadmin' ) {
|
|
1052
1054
|
query.push( {
|
|
1053
1055
|
$match: {
|
|
1054
1056
|
Teamlead: {
|
|
@@ -1088,14 +1090,16 @@ export async function userList( req, res ) {
|
|
|
1088
1090
|
},
|
|
1089
1091
|
},
|
|
1090
1092
|
];
|
|
1091
|
-
if ( req.user&&req.user.userType==='client'&&req.user.role!='superadmin' ) {
|
|
1092
|
-
let findTeams = await findteams( {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1093
|
+
if ( req.user && req.user.userType === 'client' && req.user.role != 'superadmin' ) {
|
|
1094
|
+
let findTeams = await findteams( {
|
|
1095
|
+
Teamlead: {
|
|
1096
|
+
$elemMatch: {
|
|
1097
|
+
email: req.user.email,
|
|
1098
|
+
},
|
|
1099
|
+
}, clientId: req.body.clientId,
|
|
1100
|
+
} );
|
|
1097
1101
|
req.body.teams = findTeams.map( ( data ) => data.teamName );
|
|
1098
|
-
if ( req.body.teams.length===0 ) {
|
|
1102
|
+
if ( req.body.teams.length === 0 ) {
|
|
1099
1103
|
query.push( {
|
|
1100
1104
|
$match: {
|
|
1101
1105
|
userEmail: { $in: [ req.user.email ] },
|
|
@@ -1129,3 +1133,18 @@ export async function userList( req, res ) {
|
|
|
1129
1133
|
return res.sendError( { error: error }, 500 );
|
|
1130
1134
|
}
|
|
1131
1135
|
}
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
export async function checkNotificationCount( req, res ) {
|
|
1139
|
+
try {
|
|
1140
|
+
console.log( req.user._id );
|
|
1141
|
+
let notifyRecord = await notificationModel.findnotification( { 'userId': new mongoose.Types.ObjectId( req.user._id ), 'status': 'unsend' } );
|
|
1142
|
+
let findRecord = notifyRecord.map( ( data ) => data._id );
|
|
1143
|
+
console.log( findRecord );
|
|
1144
|
+
await notificationModel.updateManynotification( { _id: { $in: findRecord } }, { $set: { 'status': 'send' } } );
|
|
1145
|
+
return res.sendSuccess( notifyRecord );
|
|
1146
|
+
} catch ( error ) {
|
|
1147
|
+
logger.error( { error: error, function: 'checkNotificationCount' } );
|
|
1148
|
+
return res.sendError( { error: error }, 500 );
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
@@ -22,7 +22,7 @@ import { sendPushNotification, sendAiPushNotification } from 'tango-app-api-midd
|
|
|
22
22
|
// import * as planoService from '../services/planogram.service.js';
|
|
23
23
|
import * as clusterServices from '../services/cluster.service.js';
|
|
24
24
|
import * as teamsServices from '../services/teams.service.js';
|
|
25
|
-
|
|
25
|
+
import * as notificationModel from '../services/notification.service.js';
|
|
26
26
|
|
|
27
27
|
const ObjectId = mongoose.Types.ObjectId;
|
|
28
28
|
dayjs.extend( customParseFormat );
|
|
@@ -2345,3 +2345,120 @@ export async function getLiveChecklistClients( req, res ) {
|
|
|
2345
2345
|
else res.sendError( error, 500 );
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
export async function notificationCreate( req, res ) {
|
|
2351
|
+
try {
|
|
2352
|
+
let insertData= [];
|
|
2353
|
+
let findAllUser = await userService.find( { clientId: '464', isActive: true } );
|
|
2354
|
+
for ( let user of findAllUser ) {
|
|
2355
|
+
for ( let store of req.body ) {
|
|
2356
|
+
let data= {};
|
|
2357
|
+
data.userId = user._id;
|
|
2358
|
+
data.storeId = store.storeId;
|
|
2359
|
+
data.storeName = store.storeName;
|
|
2360
|
+
data.captureTime = store.captureTime;
|
|
2361
|
+
data.slotNo = store.slotNo;
|
|
2362
|
+
let payload = {
|
|
2363
|
+
userType: user.userType,
|
|
2364
|
+
role: user.role,
|
|
2365
|
+
assignedStores: user.assignedStores,
|
|
2366
|
+
clientId: user.clientId,
|
|
2367
|
+
email: user.email,
|
|
2368
|
+
};
|
|
2369
|
+
let result = await storecheckExists( payload );
|
|
2370
|
+
if ( result ) {
|
|
2371
|
+
insertData.push( data );
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
let create = await notificationModel.insertManynotificationModel( insertData );
|
|
2376
|
+
// console.log( create );
|
|
2377
|
+
if ( create ) {
|
|
2378
|
+
return res.sendSuccess( 'updated successfully' );
|
|
2379
|
+
}
|
|
2380
|
+
} catch ( e ) {
|
|
2381
|
+
logger.error( { error: e, function: 'notificationCreate' } );
|
|
2382
|
+
if ( e.name === 'ValidationError' ) res.sendBadRequest( e );
|
|
2383
|
+
else res.sendError( e, 500 );
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
|
|
2388
|
+
export async function storecheckExists( data ) {
|
|
2389
|
+
try {
|
|
2390
|
+
if ( data && data.userType === 'client' && data.role !== 'superadmin' ) {
|
|
2391
|
+
let storeIds = new Set( data.assignedStores.map( ( store ) => store.storeId ) );
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
// Fetch clusters and teams in parallel
|
|
2395
|
+
const [ clustersList, teamsList ] = await Promise.all( [
|
|
2396
|
+
clusterServices.findcluster( { clientId: data.clientId, Teamlead: { $elemMatch: { email: data.email } } } ),
|
|
2397
|
+
teamsServices.findteams( { clientId: data.clientId, Teamlead: { $elemMatch: { email: data.email } } } ),
|
|
2398
|
+
] );
|
|
2399
|
+
|
|
2400
|
+
// Process clusters
|
|
2401
|
+
if ( clustersList.length > 0 ) {
|
|
2402
|
+
for ( let cluster of clustersList ) {
|
|
2403
|
+
cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
// Process teams
|
|
2408
|
+
if ( teamsList.length > 0 ) {
|
|
2409
|
+
for ( let team of teamsList ) {
|
|
2410
|
+
for ( let user of team.users ) {
|
|
2411
|
+
let findUser = await userService.findOne( { _id: user.userId } );
|
|
2412
|
+
if ( findUser && findUser.assignedStores?.length > 0 ) {
|
|
2413
|
+
findUser.assignedStores.forEach( ( store ) => storeIds.add( store.storeId ) );
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
// Fetch clusters for the user
|
|
2417
|
+
let userClustersList = await clusterServices.findcluster( { clientId: data.clientId, Teamlead: { $elemMatch: { email: findUser.email } } } );
|
|
2418
|
+
if ( userClustersList.length > 0 ) {
|
|
2419
|
+
for ( let cluster of userClustersList ) {
|
|
2420
|
+
cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
let TeamMember = await teamsServices.findteams( { clientId: data.clientId, users: { $elemMatch: { email: data.email } } } );
|
|
2427
|
+
if ( TeamMember&&TeamMember.length>0 ) {
|
|
2428
|
+
for ( let team of TeamMember ) {
|
|
2429
|
+
let clusterList = await clusterServices.findcluster( { clientId: data.clientId, teams: { $elemMatch: { name: team.teamName } } } );
|
|
2430
|
+
if ( clusterList.length > 0 ) {
|
|
2431
|
+
for ( let cluster of clusterList ) {
|
|
2432
|
+
cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
let TeamLeader = await teamsServices.findteams( { clientId: data.clientId, Teamlead: { $elemMatch: { email: data.email } } } );
|
|
2438
|
+
if ( TeamLeader&&TeamLeader.length>0 ) {
|
|
2439
|
+
for ( let team of TeamLeader ) {
|
|
2440
|
+
let clusterList = await clusterServices.findcluster( { clientId: data.clientId, teams: { $elemMatch: { name: team.teamName } } } );
|
|
2441
|
+
if ( clusterList.length > 0 ) {
|
|
2442
|
+
for ( let cluster of clusterList ) {
|
|
2443
|
+
cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
// Convert Set back to Array if needed
|
|
2449
|
+
|
|
2450
|
+
let resultStores = Array.from( storeIds );
|
|
2451
|
+
resultStores.filter( ( ele ) => ele.storeId===data.storeId );
|
|
2452
|
+
|
|
2453
|
+
if ( resultStores.length>0 ) {
|
|
2454
|
+
return true;
|
|
2455
|
+
} else {
|
|
2456
|
+
return false;
|
|
2457
|
+
}
|
|
2458
|
+
} else {
|
|
2459
|
+
return true;
|
|
2460
|
+
}
|
|
2461
|
+
} catch ( error ) {
|
|
2462
|
+
logger.error( { error: error, function: 'internalAISendPushNotification' } );
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
@@ -3672,6 +3672,40 @@ export async function checkVersion( req, res ) {
|
|
|
3672
3672
|
// if ( minor1 < minor2 ) resultData.showPopup = true;
|
|
3673
3673
|
// if ( patch1 < patch2 ) resultData.showPopup = true;
|
|
3674
3674
|
return res.sendSuccess( resultData );
|
|
3675
|
+
} catch ( e ) {
|
|
3676
|
+
console.log( 'e', e );
|
|
3677
|
+
logger.error( 'checkVersion', e );
|
|
3678
|
+
return res.sendError( e, 500 );
|
|
3679
|
+
}
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
export async function checkVersionV1( req, res ) {
|
|
3683
|
+
try {
|
|
3684
|
+
const appVersionNo = req.body.versionNo;
|
|
3685
|
+
if ( req.body.clientId ) {
|
|
3686
|
+
let getDBVersion;
|
|
3687
|
+
getDBVersion = await appService.findOne( { appName: req.body.type, clientId: req.body.clientId } );
|
|
3688
|
+
if ( !getDBVersion ) {
|
|
3689
|
+
getDBVersion = await appService.findOne( { appName: req.body.type } );
|
|
3690
|
+
}
|
|
3691
|
+
let dbVersion = getDBVersion;
|
|
3692
|
+
let resultData = {
|
|
3693
|
+
showPopup: false,
|
|
3694
|
+
forceUpdate: dbVersion.forceUpdate,
|
|
3695
|
+
appVersion: dbVersion.appVersion,
|
|
3696
|
+
appVersionNo: dbVersion.appVersionNo,
|
|
3697
|
+
appName: dbVersion.appName,
|
|
3698
|
+
clientId: dbVersion.clientId || '',
|
|
3699
|
+
};
|
|
3700
|
+
if ( dbVersion ) {
|
|
3701
|
+
if ( parseInt( dbVersion.appVersionNo ) > parseInt( appVersionNo ) ) {
|
|
3702
|
+
resultData.showPopup = true;
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
return res.sendSuccess( resultData );
|
|
3706
|
+
} else {
|
|
3707
|
+
return res.sendError( 'clientId is Required', 400 );
|
|
3708
|
+
}
|
|
3675
3709
|
} catch ( e ) {
|
|
3676
3710
|
logger.error( 'checkVersion', e );
|
|
3677
3711
|
return res.sendError( e, 500 );
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist,
|
|
3
|
+
import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist,
|
|
4
|
+
storesList, checklistDropdown, redoChecklist, redomultiChecklist, approveChecklist,
|
|
5
|
+
approvalstatus, getLogs, headerStoresV2, teamsList, userList, checkNotificationCount } from '../controllers/gallery.controller.js';
|
|
4
6
|
import express from 'express';
|
|
5
7
|
export const galleryRouter = express.Router();
|
|
6
8
|
import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
|
|
@@ -26,10 +28,8 @@ galleryRouter
|
|
|
26
28
|
.post( '/redo', isAllowedSessionHandler, redoChecklist )
|
|
27
29
|
.post( '/multiredo', isAllowedSessionHandler, redomultiChecklist )
|
|
28
30
|
.post( '/approvalstatus', isAllowedSessionHandler, approvalstatus )
|
|
29
|
-
.post( '/getLogs', isAllowedSessionHandler, getLogs )
|
|
30
|
-
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
galleryRouter
|
|
35
|
-
.post( '/userList', isAllowedSessionHandler, isAllowedClient, userList );
|
|
31
|
+
.post( '/getLogs', isAllowedSessionHandler, getLogs )
|
|
32
|
+
.post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
|
|
33
|
+
.get( '/teamsList', isAllowedSessionHandler, isAllowedClient, teamsList )
|
|
34
|
+
.post( '/userList', isAllowedSessionHandler, isAllowedClient, userList )
|
|
35
|
+
.post( '/checkNotificationCount', isAllowedSessionHandler, getAssinedStore, checkNotificationCount );
|
|
@@ -23,6 +23,7 @@ internalTraxRouter
|
|
|
23
23
|
.get( '/getDownloads', isAllowedInternalAPIHandler, internalController.getDownloads )
|
|
24
24
|
.post( '/sendPushNotification', isAllowedInternalAPIHandler, internalController.internalSendPushNotification )
|
|
25
25
|
.post( '/sendAiPushNotification', isAllowedInternalAPIHandler, internalController.internalAISendPushNotification )
|
|
26
|
-
.post( '/getLiveChecklistClients', isAllowedInternalAPIHandler, internalController.getLiveChecklistClients )
|
|
26
|
+
.post( '/getLiveChecklistClients', isAllowedInternalAPIHandler, internalController.getLiveChecklistClients )
|
|
27
|
+
.post( '/notificationCreate', isAllowedInternalAPIHandler, internalController.notificationCreate );
|
|
27
28
|
|
|
28
29
|
|
|
@@ -26,6 +26,7 @@ mobileRouter
|
|
|
26
26
|
.post( '/verifylocation', isAllowedSessionHandler, mobileController.getStoreLocation, mobileController.location )
|
|
27
27
|
.post( '/login', mobileController.login )
|
|
28
28
|
.post( '/checkUpdateVersion', mobileController.checkVersion )
|
|
29
|
+
.post( '/checkUpdateVersionv1', mobileController.checkVersionV1 )
|
|
29
30
|
.post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
|
|
30
31
|
.post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus );
|
|
31
32
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import notificationModel from 'tango-api-schema/schema/notification.model.js';
|
|
2
|
+
|
|
3
|
+
export async function updateOnenotification( query, record ) {
|
|
4
|
+
return await notificationModel.updateOne( query, { $set: record } );
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export async function updatenotification( query, record ) {
|
|
8
|
+
return await notificationModel.updateOne( query, record );
|
|
9
|
+
};
|
|
10
|
+
export async function updateManynotification( query, record ) {
|
|
11
|
+
return await notificationModel.updateMany( query, record );
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function aggregatenotification( query ) {
|
|
15
|
+
return await notificationModel.aggregate( query );
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export async function findOnenotification( query ={}, field={} ) {
|
|
19
|
+
return await notificationModel.findOne( query, field );
|
|
20
|
+
};
|
|
21
|
+
export async function findnotification( query ={}, field={} ) {
|
|
22
|
+
return await notificationModel.find( query, field );
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export async function createnotificationModel( query ={}, field={} ) {
|
|
26
|
+
return await notificationModel.create( query, field );
|
|
27
|
+
};
|
|
28
|
+
export async function insertManynotificationModel( query ={}, field={} ) {
|
|
29
|
+
return await notificationModel.insertMany( query, field );
|
|
30
|
+
};
|
|
31
|
+
|