tango-app-api-infra 3.1.34-beta.35 → 3.1.34-beta.37

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-infra",
3
- "version": "3.1.34-beta.35",
3
+ "version": "3.1.34-beta.37",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
1
 
2
- import { aggregateStore, countDocumentsStore } from '../services/store.service.js';
2
+ import { aggregateStore, countDocumentsStore, findStore } from '../services/store.service.js';
3
3
  import { logger, download, getUTC } from 'tango-app-api-middleware';
4
4
  import { aggregateTangoTicket } from '../services/tangoTicket.service.js';
5
5
  import { findinfraReason } from '../services/infraReason.service.js';
@@ -17,7 +17,11 @@ export async function infraCard( req, res ) {
17
17
  if ( req.user&&req.user.userType ==='client'&&req.user.role!='superadmin' ) {
18
18
  storecountQuery = { ...storecountQuery, ...{ storeId: { $in: req.body.assignedStores } } };
19
19
  }
20
+
20
21
  let storeCount = await countDocumentsStore( storecountQuery );
22
+ let stores = await findStore( { 'clientId': { $in: req.body.clientId }, 'status': 'active' } );
23
+ let storelist = stores.map( ( data ) => data.storeId );
24
+
21
25
  let yetToInstallQuery = [
22
26
  {
23
27
  $match: {
@@ -25,6 +29,7 @@ export async function infraCard( req, res ) {
25
29
  { issueType: 'installation' },
26
30
  { 'status': { $ne: 'closed' } },
27
31
  { 'basicDetails.clientId': { $in: req.body.clientId } },
32
+ { 'basicDetails.storeId': { $in: storelist } },
28
33
  { createdAt: { $lte: date.end } },
29
34
  ],
30
35
  },
@@ -239,6 +244,8 @@ export async function installationCard( req, res ) {
239
244
  let onboardedCount = await countDocumentsStore( onboardQuery );
240
245
  let installedCount = await countDocumentsStore( installedQuery );
241
246
  let deactiveCount = await countDocumentsStore( deactiveQuery );
247
+ let stores = await findStore( { 'clientId': { $in: req.body.clientId }, 'status': 'active' } );
248
+ let storelist = stores.map( ( data ) => data.storeId );
242
249
 
243
250
 
244
251
  let ticketbaseQuery = [
@@ -248,6 +255,7 @@ export async function installationCard( req, res ) {
248
255
  { issueType: 'installation' },
249
256
  { 'status': { $ne: 'closed' } },
250
257
  { 'basicDetails.clientId': { $in: req.body.clientId } },
258
+ { 'basicDetails.storeId': { $in: storelist } },
251
259
  { createdAt: { $lte: date.end } },
252
260
  ],
253
261
  },
@@ -16,7 +16,10 @@ import mongoose from 'mongoose';
16
16
  import _ from 'lodash';
17
17
  import { aggregateUserAssignedStore, findUserAssignedStore } from '../services/userAssignedStore.service.js';
18
18
  import { aggregateCamera } from '../services/camera.service.js';
19
- import { aggregatemailonlyuser, createmailonlyuser, updateonemailonlyuser, findOnemailonlyuser } from '../services/mailonlyusers.service.js';
19
+ import { aggregatemailonlyuser, createmailonlyuser, updateonemailonlyuser, findOnemailonlyuser, deletemailonlyuser } from '../services/mailonlyusers.service.js';
20
+ import { findcluster } from '../services/cluster.service.js';
21
+ import { findteams } from '../services/teams.service.js';
22
+
20
23
  export async function createTicket( req, res ) {
21
24
  try {
22
25
  req.body.issueDate = new Date( req.body.Date );
@@ -551,6 +554,134 @@ export async function emailUserList( req, res ) {
551
554
  return res.sendError( error, 500 );
552
555
  }
553
556
  }
557
+
558
+ export async function emailUserListv2( req, res ) {
559
+ try {
560
+ let inputData = req.body;
561
+ let query = [
562
+ {
563
+ $match: {
564
+ userType: 'client',
565
+ clientId: inputData.clientId,
566
+ role: inputData.role,
567
+ isActive: true,
568
+ },
569
+ },
570
+ {
571
+ $project: {
572
+ userName: 1,
573
+ email: 1,
574
+ role: 1,
575
+ emailAlert: 1,
576
+ infraAlert: { $ifNull: [ '$emailAlert.infra', false ] },
577
+ isActive: 1,
578
+ mobileNumber: 1,
579
+ assignedStores: 1,
580
+ },
581
+ },
582
+
583
+ ];
584
+ if ( req.body.searchValue && req.body.searchValue != '' ) {
585
+ query.push( {
586
+ $match: {
587
+ $or: [
588
+ { userName: { $regex: req.body.searchValue, $options: 'i' } },
589
+ { email: { $regex: req.body.searchValue, $options: 'i' } },
590
+ ],
591
+ },
592
+ } );
593
+ }
594
+ if ( req.body.sortColumName && req.body.sortColumName !== '' && req.body.sortBy ) {
595
+ query.push( {
596
+ $sort: { [req.body.sortColumName]: req.body.sortBy },
597
+ } );
598
+ }
599
+ const count = await aggregateUser( query );
600
+ if ( req.body.limit && req.body.offset && !req.body.export ) {
601
+ query.push(
602
+ { $skip: ( req.body.offset - 1 ) * req.body.limit },
603
+ { $limit: Number( req.body.limit ) },
604
+ );
605
+ }
606
+ const result = await aggregateUser( query );
607
+ for ( let user of result ) {
608
+ if ( user.role !== 'superadmin' ) {
609
+ let storeIds =new Set();
610
+ if ( user.assignedStores ) {
611
+ storeIds = new Set( user.assignedStores.map( ( store ) => store.storeId ) );
612
+ }
613
+
614
+ // Fetch clusters and teams in parallel
615
+ const [ clustersList, teamsList ] = await Promise.all( [
616
+ findcluster( { clientId: inputData.clientId, Teamlead: { $elemMatch: { email: user.email } } } ),
617
+ findteams( { clientId: inputData.clientId, Teamlead: { $elemMatch: { email: user.email } } } ),
618
+ ] );
619
+
620
+ // Process clusters
621
+ if ( clustersList.length > 0 ) {
622
+ for ( let cluster of clustersList ) {
623
+ cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
624
+ }
625
+ }
626
+
627
+ // Process teams
628
+ if ( teamsList.length > 0 ) {
629
+ for ( let team of teamsList ) {
630
+ for ( let user of team.users ) {
631
+ let findUser = await findOneUser( { _id: user.userId } );
632
+ if ( findUser && findUser.assignedStores?.length > 0 ) {
633
+ findUser.assignedStores.forEach( ( store ) => storeIds.add( store.storeId ) );
634
+ }
635
+
636
+ // Fetch clusters for the user
637
+ let userClustersList = await findcluster( { clientId: inputData.clientId, Teamlead: { $elemMatch: { email: findUser.email } } } );
638
+ if ( userClustersList.length > 0 ) {
639
+ for ( let cluster of userClustersList ) {
640
+ cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
641
+ }
642
+ }
643
+ }
644
+ }
645
+ }
646
+ let TeamMember = await findteams( { clientId: inputData.clientId, users: { $elemMatch: { email: user.email } } } );
647
+ if ( TeamMember&&TeamMember.length>0 ) {
648
+ for ( let team of TeamMember ) {
649
+ let clusterList = await findcluster( { clientId: inputData.clientId, teams: { $elemMatch: { name: team.teamName } } } );
650
+ if ( clusterList.length > 0 ) {
651
+ for ( let cluster of clusterList ) {
652
+ cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
653
+ }
654
+ }
655
+ }
656
+ }
657
+ let TeamLeader = await findteams( { clientId: inputData.clientId, Teamlead: { $elemMatch: { email: user.email } } } );
658
+ if ( TeamLeader&&TeamLeader.length>0 ) {
659
+ for ( let team of TeamLeader ) {
660
+ let clusterList = await findcluster( { clientId: inputData.clientId, teams: { $elemMatch: { name: team.teamName } } } );
661
+ if ( clusterList.length > 0 ) {
662
+ for ( let cluster of clusterList ) {
663
+ cluster.stores.forEach( ( store ) => storeIds.add( store.storeId ) );
664
+ }
665
+ }
666
+ }
667
+ }
668
+ user.assigned = Array.from( storeIds );
669
+ let storeList = await findStore( { clientId: inputData.clientId, storeId: { $in: user.assigned }, status: 'active' }, { storeId: 1, storeName: 1 } );
670
+ user.assigned = storeList.length;
671
+ user.assignedValue = storeList;
672
+ } else {
673
+ let storeList = await findStore( { clientId: inputData.clientId, status: 'active' }, { storeId: 1, storeName: 1 } );
674
+ user.assigned = storeList.length;
675
+ user.assignedValue = storeList;
676
+ }
677
+ }
678
+ res.sendSuccess( { count: count.length, result: result } );
679
+ } catch ( error ) {
680
+ logger.error( { error: error, function: 'emailUserList' } );
681
+ return res.sendError( error, 500 );
682
+ }
683
+ }
684
+
554
685
  export async function OutsideUserList( req, res ) {
555
686
  try {
556
687
  let inputData = req.body;
@@ -657,7 +788,114 @@ export async function OutsideUserList( req, res ) {
657
788
  return res.sendError( error, 500 );
658
789
  }
659
790
  }
791
+ export async function OutsideUserListv2( req, res ) {
792
+ try {
793
+ let inputData = req.body;
794
+ let query = [
795
+ {
796
+ $match: {
797
+ clientId: inputData.clientId,
798
+ },
799
+ },
800
+ {
801
+ $unwind: {
802
+ path: '$clusters', preserveNullAndEmptyArrays: true,
803
+ },
804
+ },
805
+ {
806
+ $lookup: {
807
+ from: 'clusters',
808
+ let: { cluster: '$clusters' },
809
+ pipeline: [
810
+ {
811
+ $match: {
812
+ $expr: {
813
+ $and: [
814
+ { $eq: [ '$_id', '$$cluster' ] },
815
+ { $eq: [ '$clientId', inputData.clientId ] },
816
+ ],
817
+ },
818
+ },
819
+ },
820
+ {
821
+ $project: {
822
+ stores: 1,
823
+ },
824
+ },
825
+ ], as: 'clusters',
826
+ },
827
+ },
828
+ {
829
+ $unwind: {
830
+ path: '$clusters', preserveNullAndEmptyArrays: true,
831
+ },
832
+ },
833
+ {
834
+ $project: {
835
+ name: 1,
836
+ email: 1,
837
+ emailAlert: 1,
838
+ stores: { $ifNull: [ '$stores', [] ] },
839
+ infraAlert: { $ifNull: [ '$emailAlert.infra', false ] },
840
+ clusters: { $ifNull: [ '$clusters.stores', [] ] },
841
+ },
842
+ },
843
+ {
844
+ $group: {
845
+ _id: '$_id',
846
+ name: { $first: '$name' },
847
+ email: { $first: '$email' },
848
+ emailAlert: { $first: '$emailAlert' },
849
+ stores: { $first: '$stores' },
850
+ infraAlert: { $first: '$infraAlert' },
851
+ clusters: { $first: '$clusters' },
852
+ },
853
+ },
854
+
855
+ ];
856
+ if ( req.body.searchValue && req.body.searchValue != '' ) {
857
+ query.push( {
858
+ $match: {
859
+ $or: [
860
+ { userName: { $regex: req.body.searchValue, $options: 'i' } },
861
+ { email: { $regex: req.body.searchValue, $options: 'i' } },
862
+ ],
863
+ },
864
+ } );
865
+ }
866
+ if ( req.body.sortColumName && req.body.sortColumName !== '' && req.body.sortBy ) {
867
+ query.push( {
868
+ $sort: { [req.body.sortColumName]: req.body.sortBy },
869
+ } );
870
+ }
871
+ const count = await aggregatemailonlyuser( query );
872
+ if ( req.body.limit && req.body.offset && !req.body.export ) {
873
+ query.push(
874
+ { $skip: ( req.body.offset - 1 ) * req.body.limit },
875
+ { $limit: Number( req.body.limit ) },
876
+ );
877
+ }
878
+ const result = await aggregatemailonlyuser( query );
660
879
 
880
+ for ( let data of result ) {
881
+ console.log( data.clusters );
882
+ let storelist = data.clusters.map( ( data ) => data.storeId );
883
+ data.Finalstores = [ ...data.stores, ...storelist ];
884
+ data.Finalstores = [ ...new Set( data.Finalstores ) ];
885
+ data.assigned = data.Finalstores.length;
886
+ data.assignedValue=[];
887
+ for ( let store of data.Finalstores ) {
888
+ let obj = { storeName: store };
889
+ data.assignedValue.push( obj );
890
+ }
891
+ }
892
+
893
+ res.sendSuccess( { count: count.length, result: result } );
894
+ } catch ( error ) {
895
+ logger.error( { error: error, function: 'OutsideUserList' } );
896
+ return res.sendError( error, 500 );
897
+ }
898
+ }
661
899
  export async function AddemailUser( req, res ) {
662
900
  try {
663
901
  let userExist = await findOneUser( { email: req.body.data.email, clientId: req.body.clientId } );
@@ -682,6 +920,93 @@ export async function AddemailUser( req, res ) {
682
920
  return res.sendError( error, 500 );
683
921
  }
684
922
  }
923
+ export async function AddemailUserv2( req, res ) {
924
+ try {
925
+ let userExist = await findOneUser( { email: req.body.data.email, clientId: req.body.clientId } );
926
+ if ( userExist ) {
927
+ return res.sendError( 'Email Already Exist', 500 );
928
+ }
929
+ let userMailExist = await findOnemailonlyuser( { email: req.body.data.email, clientId: req.body.clientId } );
930
+ if ( userMailExist ) {
931
+ return res.sendError( 'Email Already Exist', 500 );
932
+ }
933
+ let clusterList = [];
934
+
935
+ if ( req.body.data.clusters&&req.body.data.clusters.length>0 ) {
936
+ let cluster = await findcluster( { clientId: req.body.clientId, clusterName: { $in: req.body.data.clusters } } );
937
+ clusterList = cluster.map( ( data ) => data._id );
938
+ }
939
+
940
+ let data = {
941
+ clientId: req.body.clientId,
942
+ email: req.body.data.email,
943
+ name: req.body.data.userName,
944
+ stores: req.body.data.stores,
945
+ clusters: clusterList,
946
+ };
947
+ let mailOnlyUsers = await createmailonlyuser( data );
948
+ res.sendSuccess( mailOnlyUsers );
949
+ } catch ( error ) {
950
+ logger.error( { error: error, function: 'AddemailUserv2' } );
951
+ return res.sendError( error, 500 );
952
+ }
953
+ }
954
+
955
+ export async function getOutsideUser( req, res ) {
956
+ try {
957
+ let response= {};
958
+ let finduser = await findOnemailonlyuser( { _id: req.body.userId } );
959
+ response.name = finduser.name;
960
+ response.email = finduser.email;
961
+ if ( finduser&&finduser.stores&&finduser.stores.length>0 ) {
962
+ let storeslist = await findStore( { storeId: { $in: finduser.stores } }, { storeId: 1, storeName: 1 } );
963
+ response.stores = storeslist;
964
+ }
965
+ if ( finduser&&finduser.clusters&&finduser.clusters.length>0 ) {
966
+ let result = await findcluster( { _id: { $in: finduser.clusters } }, { clusterName: 1 } );
967
+ response.clusters = result;
968
+ return res.sendSuccess( response );
969
+ } else {
970
+ return res.sendSuccess( response );
971
+ }
972
+ } catch ( error ) {
973
+ logger.error( { error: error, function: 'getOutsideUser' } );
974
+ return res.sendError( error, 500 );
975
+ }
976
+ }
977
+
978
+ export async function deleteOutsideUser( req, res ) {
979
+ try {
980
+ let deletedata = await deletemailonlyuser( { _id: new mongoose.Types.ObjectId( req.body.userId ) } );
981
+ if ( deletedata ) {
982
+ res.sendSuccess( 'deleted successfully' );
983
+ }
984
+ } catch ( error ) {
985
+ logger.error( { error: error, function: 'deleteOutsideUser' } );
986
+ return res.sendError( error, 500 );
987
+ }
988
+ }
989
+ export async function editemailUser( req, res ) {
990
+ try {
991
+ let userExist = await findOneUser( { email: req.body.email, clientId: req.body.clientId } );
992
+ if ( userExist ) {
993
+ return res.sendError( 'Email Already Exist', 500 );
994
+ }
995
+ let userMailExist = await findOnemailonlyuser( { email: req.body.email, _id: { $ne: new mongoose.Types.ObjectId( req.body.userId ) }, clientId: req.body.clientId } );
996
+ if ( userMailExist ) {
997
+ return res.sendError( 'Email Already Exist', 500 );
998
+ }
999
+ console.log( req.body );
1000
+
1001
+ let update = await updateonemailonlyuser( { _id: new mongoose.Types.ObjectId( req.body.userId ) }, req.body );
1002
+ if ( update ) {
1003
+ res.sendSuccess( 'deleted successfully' );
1004
+ }
1005
+ } catch ( error ) {
1006
+ logger.error( { error: error, function: 'editemailUser' } );
1007
+ return res.sendError( error, 500 );
1008
+ }
1009
+ }
685
1010
 
686
1011
  export async function saveInfraEmailConfig( req, res ) {
687
1012
  try {
@@ -501,9 +501,11 @@ export async function emailUserList( req, res ) {
501
501
  if ( user.assignedType == 'group' ) {
502
502
  user.storeList = [];
503
503
  for ( let group of user.assignedValue ) {
504
- let groupdata = await findOneGroup( { 'groupName': group, 'clientId': user.clientId } );
505
- let storelist = await findStore( { 'storeId': { $in: groupdata.storeList }, 'status': 'active', 'edge.firstFile': true }, { 'storeId': 1, 'storeProfile.timeZone': 1 } );
506
- user.storeList = [ ...user.storeList, ...storelist ];
504
+ let groupdata = await findOneGroup( { '_id': group, 'clientId': user.clientId } );
505
+ if ( groupdata&&groupdata.storeList ) {
506
+ let storelist = await findStore( { 'storeId': { $in: groupdata.storeList }, 'status': 'active', 'edge.firstFile': true }, { 'storeId': 1, 'storeProfile.timeZone': 1 } );
507
+ user.storeList = [ ...user.storeList, ...storelist ];
508
+ }
507
509
  }
508
510
  }
509
511
  }
@@ -3,7 +3,7 @@ import express from 'express';
3
3
  import { isAllowedSessionHandler, validate, getAssinedStore } from 'tango-app-api-middleware';
4
4
  import { validateDetails, bulkvalidateDetails, validateTicket, bulkvalidateTicket, validateTicketstatus, ticketExists, infraReasonExists, InfrastepstoResolve, InfraAlert } from '../validations/infra.validation.js';
5
5
  import { createTicket, bulkcreateTicket, updateStatus, createReason, PrimaryReasons, matTable, removeAttachment,
6
- secondaryReason, updateTicketIssue, viewTicket, AlertTicketReply, uploadAttachments, getInfraIssues, AddemailUser, OutsideUserList,
6
+ secondaryReason, updateTicketIssue, viewTicket, AlertTicketReply, uploadAttachments, getInfraIssues, AddemailUser, OutsideUserList, emailUserListv2, OutsideUserListv2, AddemailUserv2, getOutsideUser, deleteOutsideUser, editemailUser,
7
7
  updateInstallationTicket, emailUserList, saveInfraEmailConfig, invoice, allCounts, infraTable, dataMismatchTable, storeFilter, assignTicket, installationTable } from '../controllers/infra.controllers.js';
8
8
  import { getInfraIssueValid } from '../dtos/infra.dtos.js';
9
9
 
@@ -23,9 +23,20 @@ infraRouter.put( '/uploadAttachments/:ticketId', isAllowedSessionHandler, ticket
23
23
  infraRouter.put( '/removeAttachment/:ticketId', isAllowedSessionHandler, ticketExists, removeAttachment );
24
24
  infraRouter.post( '/updateInstallationTicket', isAllowedSessionHandler, ticketExists, updateInstallationTicket );
25
25
  infraRouter.post( '/emailUserList', isAllowedSessionHandler, emailUserList );
26
+ infraRouter.post( '/emailUserListv2', isAllowedSessionHandler, emailUserListv2 );
27
+
26
28
  infraRouter.post( '/OutsideUserList', isAllowedSessionHandler, OutsideUserList );
29
+ infraRouter.post( '/OutsideUserListv2', isAllowedSessionHandler, OutsideUserListv2 );
30
+
27
31
 
28
32
  infraRouter.post( '/AddemailUser', isAllowedSessionHandler, AddemailUser );
33
+ infraRouter.post( '/AddemailUserv2', isAllowedSessionHandler, AddemailUserv2 );
34
+ infraRouter.post( '/getOutsideUser', isAllowedSessionHandler, getOutsideUser );
35
+ infraRouter.post( '/editemailUser', isAllowedSessionHandler, editemailUser );
36
+
37
+ infraRouter.post( '/deleteOutsideUser', isAllowedSessionHandler, deleteOutsideUser );
38
+
39
+
29
40
  infraRouter.post( '/saveInfraEmailConfig', isAllowedSessionHandler, saveInfraEmailConfig );
30
41
  infraRouter.post( '/invoice', invoice );
31
42
  infraRouter.post( '/allCounts', isAllowedSessionHandler, getAssinedStore, allCounts );
@@ -1,38 +1,23 @@
1
1
  import express from 'express';
2
- import { isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
2
+ import { isAllowedSessionHandler, accessVerification } from 'tango-app-api-middleware';
3
3
  import { userTakeTicket, userTicketList, activeTicketList, basicDetails, workHistory, pendingTicket, storeInfraList } from '../controllers/userInfra.controller.js';
4
4
 
5
5
  export const userInfraRouter = express.Router();
6
6
 
7
7
 
8
- userInfraRouter.post( '/userTakeTicket', isAllowedSessionHandler, authorize( {
9
- userType: [ 'tango' ], access: [
10
- { featureName: 'manage', name: 'tickets', permissions: [ 'isEdit', 'isView' ] } ],
11
- } ), userTakeTicket );
12
- userInfraRouter.post( '/userTicketList', isAllowedSessionHandler, authorize( {
13
- userType: [ 'tango' ], access: [
14
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
15
- } ), userTicketList );
16
- userInfraRouter.post( '/activeTicketList', isAllowedSessionHandler, authorize( {
17
- userType: [ 'tango' ], access: [
18
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
19
- } ), activeTicketList );
20
- userInfraRouter.post( '/basicDetails', isAllowedSessionHandler, authorize( {
21
- userType: [ 'tango' ], access: [
22
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
23
- } ), basicDetails );
24
- userInfraRouter.post( '/workHistory', isAllowedSessionHandler, authorize( {
25
- userType: [ 'tango' ], access: [
26
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] } ],
27
- } ), workHistory );
28
- userInfraRouter.post( '/storeInfraList', isAllowedSessionHandler, authorize( {
29
- userType: [ 'tango', 'client' ], access: [
30
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] },
31
- ],
32
- } ), storeInfraList );
33
- userInfraRouter.post( '/pendingTicket', isAllowedSessionHandler, authorize( {
34
- userType: [ 'tango', 'client' ], access: [
35
- { featureName: 'manage', name: 'tickets', permissions: [ 'isView' ] },
36
- ],
37
- } ), pendingTicket );
8
+ userInfraRouter.post( '/userTakeTicket', isAllowedSessionHandler,
9
+ accessVerification( { userType: [ 'tango' ], access: [] } ),
10
+ userTakeTicket );
11
+ userInfraRouter.post( '/userTicketList', isAllowedSessionHandler,
12
+ accessVerification( { userType: [ 'tango' ], access: [] } ), userTicketList );
13
+ userInfraRouter.post( '/activeTicketList', isAllowedSessionHandler,
14
+ accessVerification( { userType: [ 'tango' ], access: [] } ), activeTicketList );
15
+ userInfraRouter.post( '/basicDetails', isAllowedSessionHandler,
16
+ accessVerification( { userType: [ 'tango' ], access: [] } ), basicDetails );
17
+ userInfraRouter.post( '/workHistory', isAllowedSessionHandler,
18
+ accessVerification( { userType: [ 'tango' ], access: [] } ), workHistory );
19
+ userInfraRouter.post( '/storeInfraList', isAllowedSessionHandler,
20
+ accessVerification( { userType: [ 'tango' ], access: [] } ), storeInfraList );
21
+ userInfraRouter.post( '/pendingTicket', isAllowedSessionHandler,
22
+ accessVerification( { userType: [ 'tango' ], access: [] } ), pendingTicket );
38
23
 
@@ -0,0 +1,31 @@
1
+ import clusterModel from 'tango-api-schema/schema/cluster.model.js';
2
+
3
+ export async function updateOneCluster( query, record ) {
4
+ return await clusterModel.updateOne( query, { $set: record } );
5
+ };
6
+
7
+ export async function updateCluster( query, record ) {
8
+ return await clusterModel.updateMany( query, record );
9
+ };
10
+
11
+ export async function aggregateCluster( query ) {
12
+ return await clusterModel.aggregate( query );
13
+ };
14
+
15
+ export async function findOneCluster( query ={}, field={} ) {
16
+ return await clusterModel.findOne( query, field );
17
+ };
18
+ export async function deleteCluster( query ={} ) {
19
+ return await clusterModel.deleteOne( query );
20
+ };
21
+
22
+ export async function createclusterModel( data ) {
23
+ return await clusterModel.create( data );
24
+ };
25
+
26
+ export async function findcluster( query, project ) {
27
+ return await clusterModel.find( query, project );
28
+ };
29
+ export function countDocumentsClusters( query ) {
30
+ return clusterModel.countDocuments( query );
31
+ }
@@ -19,3 +19,6 @@ export async function aggregatemailonlyuser( query ) {
19
19
  export async function updateonemailonlyuser( query, data ) {
20
20
  return await dataModel.mailOnlyuserModel.updateOne( query, { $set: data } );
21
21
  }
22
+ export async function deletemailonlyuser( query ={} ) {
23
+ return await dataModel.mailOnlyuserModel.deleteOne( query );
24
+ };
@@ -0,0 +1,30 @@
1
+ import teamsModel from 'tango-api-schema/schema/teams.model.js';
2
+
3
+
4
+ export async function createTeamsModel( data ) {
5
+ return await teamsModel.create( data );
6
+ };
7
+ export async function updateOneTeams( query, record ) {
8
+ return await teamsModel.updateOne( query, { $set: record }, { upsert: true } );
9
+ };
10
+
11
+ export async function aggregateTeams( query ) {
12
+ return await teamsModel.aggregate( query );
13
+ };
14
+ export async function deleteTeams( query ={} ) {
15
+ return await teamsModel.deleteOne( query );
16
+ };
17
+
18
+ export async function findOneTeams( query ={}, field={} ) {
19
+ return await teamsModel.findOne( query, field );
20
+ };
21
+ export async function findteams( query ={}, field={} ) {
22
+ return await teamsModel.find( query, field );
23
+ };
24
+
25
+ export async function updateOneTeamModel( query, record ) {
26
+ return await teamsModel.updateOne( query, record );
27
+ }
28
+ export function countDocumentsTeams( query ) {
29
+ return teamsModel.countDocuments( query );
30
+ }