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

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.36",
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( { 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( { 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
  },
@@ -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