tango-app-api-analysis-traffic 3.0.0-alpha.2 → 3.0.0-alpha.21

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.
@@ -0,0 +1,191 @@
1
+ import express from 'express';
2
+ import { validate, isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
3
+ import * as validationDtos from '../dtos/validation.dtos.js';
4
+ export const mobileTrafficAnalysisRouter = express.Router();
5
+ import {
6
+ cardsFunnelV1,
7
+ cardsGraphsV1,
8
+ recapVideoV1,
9
+ densityDwellV1,
10
+ overallCardsV1,
11
+ overallHourlyChartV1,
12
+ overallChartV1,
13
+ singleStoreChartV1,
14
+ demographicChartV1,
15
+ footfallDirectoryFoldersV1,
16
+ footfallDirectoryV1,
17
+ footfallTrendV1,
18
+ storeOperationV1,
19
+ performanceMatrixV1,
20
+ zoneDwellTimeSplitV1,
21
+ isAllowedClient,
22
+ getMySubscription,
23
+ buyerChartV1,
24
+ } from '../controllers/mobileTraffic.controllers.js';
25
+
26
+ mobileTrafficAnalysisRouter
27
+ .post( '/cardsFunnel_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
28
+
29
+ userType: [ 'tango', 'client' ], access: [
30
+
31
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
32
+
33
+ ],
34
+
35
+ } ), validate( validationDtos.validateCardFunnelParams ), cardsFunnelV1 )
36
+
37
+ .post( '/cardsGraphs_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
38
+
39
+ userType: [ 'tango', 'client' ], access: [
40
+
41
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
42
+
43
+ ],
44
+
45
+ } ), validate( validationDtos.validateCardGraphParams ), cardsGraphsV1 )
46
+
47
+ .post( '/recapVideo_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
48
+
49
+ userType: [ 'tango', 'client' ], access: [
50
+
51
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
52
+
53
+ ],
54
+
55
+ } ), validate( validationDtos.validateRecapVideoParams ), recapVideoV1 )
56
+
57
+ .post( '/densityDwell_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
58
+
59
+ userType: [ 'tango', 'client' ], access: [
60
+
61
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
62
+
63
+ ],
64
+
65
+ } ), validate( validationDtos.validateDensityDwellParams ), densityDwellV1 )
66
+
67
+ .post( '/overallCards_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
68
+
69
+ userType: [ 'tango', 'client' ], access: [
70
+
71
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
72
+
73
+ ],
74
+
75
+ } ), validate( validationDtos.validateOverallCharParams ), overallCardsV1 )
76
+
77
+ .post( '/overallHourlyChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
78
+
79
+ userType: [ 'tango', 'client' ], access: [
80
+
81
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
82
+
83
+ ],
84
+
85
+ } ), validate( validationDtos.validateOverallCharParams ), overallHourlyChartV1 )
86
+
87
+ .post( '/overallChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
88
+
89
+ userType: [ 'tango', 'client' ], access: [
90
+
91
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
92
+
93
+ ],
94
+
95
+ } ), validate( validationDtos.validateOverallCharParams ), overallChartV1 )
96
+
97
+ .post( '/singleStoreChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
98
+
99
+ userType: [ 'tango', 'client' ], access: [
100
+
101
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
102
+
103
+ ],
104
+
105
+ } ), validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV1 )
106
+
107
+ .post( '/demographicChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
108
+
109
+ userType: [ 'tango', 'client' ], access: [
110
+
111
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
112
+
113
+ ],
114
+
115
+ } ), validate( validationDtos.validateDemographicChartParams ), demographicChartV1 )
116
+
117
+ .post( '/buyerChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
118
+
119
+ userType: [ 'tango', 'client' ], access: [
120
+
121
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
122
+
123
+ ],
124
+
125
+ } ), validate( validationDtos.validateBuyerChartParams ), buyerChartV1 )
126
+
127
+ .post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
128
+
129
+ userType: [ 'tango', 'client' ], access: [
130
+
131
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
132
+
133
+ ],
134
+
135
+ } ), validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV1 )
136
+
137
+ .post( '/footfallDirectory_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
138
+
139
+ userType: [ 'tango', 'client' ], access: [
140
+
141
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
142
+
143
+ ],
144
+
145
+ } ), validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV1 )
146
+
147
+ .post( '/footfallTrend_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
148
+
149
+ userType: [ 'tango', 'client' ], access: [
150
+
151
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
152
+
153
+ ],
154
+
155
+ } ), validate( validationDtos.validateFootfallTrendParams ), footfallTrendV1 )
156
+
157
+ .post( '/storeOperation_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
158
+
159
+ userType: [ 'tango', 'client' ], access: [
160
+
161
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
162
+
163
+ ],
164
+
165
+ } ), validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
166
+
167
+ .post( '/performanceMatrix_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
168
+
169
+ userType: [ 'tango', 'client' ], access: [
170
+
171
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
172
+
173
+ ],
174
+
175
+ } ), validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
176
+
177
+ .post( '/zoneDwellTimeSplit_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
178
+
179
+ userType: [ 'tango', 'client' ], access: [
180
+
181
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
182
+
183
+ ],
184
+
185
+ } ), validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV1 )
186
+
187
+ .post( '/getMySubscription_v1', isAllowedSessionHandler, validate( validationDtos.getMyProductParams ), getMySubscription );
188
+
189
+
190
+ export default mobileTrafficAnalysisRouter;
191
+
@@ -45,10 +45,15 @@ import {
45
45
  summaryTableV1,
46
46
  footfallTrendV1,
47
47
  storeOperationV1,
48
+ performanceMatrixV1,
49
+ zoneDwellTimeSplitV1,
48
50
  storesMapV1,
49
51
  headerStoresV1,
50
52
  headerLocationsV1,
51
53
  headerGroupsV1,
54
+ isAllowedClient,
55
+ getMySubscription,
56
+ getStoreMapData,
52
57
  } from '../controllers/tangoTrafficV1.controllers.js';
53
58
 
54
59
 
@@ -75,100 +80,112 @@ analysisTrafficRouter
75
80
  .post( '/headerLocations', headerLocations )
76
81
  .post( '/headerGroups', headerGroups )
77
82
  .post( '/headerStores', headerStores )
78
- .post( '/cardsFunnel_v1', isAllowedSessionHandler, authorize( {
83
+ .post( '/cardsFunnel_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
79
84
  userType: [ 'tango', 'client' ], access: [
80
85
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
81
86
  ],
82
87
  } ), validate( validationDtos.validateCardFunnelParams ), cardsFunnelV1 )
83
- .post( '/cardsGraphs_v1', isAllowedSessionHandler, authorize( {
88
+ .post( '/cardsGraphs_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
84
89
  userType: [ 'tango', 'client' ], access: [
85
90
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
86
91
  ],
87
92
  } ), validate( validationDtos.validateCardGraphParams ), cardsGraphsV1 )
88
- .post( '/recapVideo_v1', isAllowedSessionHandler, authorize( {
93
+ .post( '/recapVideo_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
89
94
  userType: [ 'tango', 'client' ], access: [
90
95
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
91
96
  ],
92
97
  } ), validate( validationDtos.validateRecapVideoParams ), recapVideoV1 )
93
- .post( '/densityDwell_v1', isAllowedSessionHandler, authorize( {
98
+ .post( '/densityDwell_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
94
99
  userType: [ 'tango', 'client' ], access: [
95
100
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
96
101
  ],
97
102
  } ), validate( validationDtos.validateDensityDwellParams ), densityDwellV1 )
98
- .post( '/overallCards_v1', isAllowedSessionHandler, authorize( {
103
+ .post( '/overallCards_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
99
104
  userType: [ 'tango', 'client' ], access: [
100
105
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
101
106
  ],
102
- } ), validate( validationDtos.validateOverallCardsParams ), overallCardsV1 )
103
- .post( '/overallHourlyChart_v1', isAllowedSessionHandler, authorize( {
107
+ } ), validate( validationDtos.validateOverallCharParams ), overallCardsV1 )
108
+ .post( '/overallHourlyChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
104
109
  userType: [ 'tango', 'client' ], access: [
105
110
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
106
111
  ],
107
- } ), validate( validationDtos.validateOverallHourlyChartParams ), overallHourlyChartV1 )
108
- .post( '/overallChart_v1', isAllowedSessionHandler, authorize( {
112
+ } ), validate( validationDtos.validateOverallCharParams ), overallHourlyChartV1 )
113
+ .post( '/overallChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
109
114
  userType: [ 'tango', 'client' ], access: [
110
115
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
111
116
  ],
112
117
  } ), validate( validationDtos.validateOverallCharParams ), overallChartV1 )
113
- .post( '/singleStoreChart_v1', isAllowedSessionHandler, authorize( {
118
+ .post( '/singleStoreChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
114
119
  userType: [ 'tango', 'client' ], access: [
115
120
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
116
121
  ],
117
122
  } ), validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV1 )
118
- .post( '/demographicChart_v1', isAllowedSessionHandler, authorize( {
123
+ .post( '/demographicChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
119
124
  userType: [ 'tango', 'client' ], access: [
120
125
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
121
126
  ],
122
127
  } ), validate( validationDtos.validateDemographicChartParams ), demographicChartV1 )
123
- .post( '/buyerChart_v1', isAllowedSessionHandler, authorize( {
128
+ .post( '/buyerChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
124
129
  userType: [ 'tango', 'client' ], access: [
125
130
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
126
131
  ],
127
132
  } ), validate( validationDtos.validateBuyerChartParams ), buyerChartV1 )
128
- .post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler, authorize( {
133
+ .post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
129
134
  userType: [ 'tango', 'client' ], access: [
130
135
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
131
136
  ],
132
137
  } ), validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV1 )
133
- .post( '/footfallDirectory_v1', isAllowedSessionHandler, authorize( {
138
+ .post( '/footfallDirectory_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
134
139
  userType: [ 'tango', 'client' ], access: [
135
140
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
136
141
  ],
137
142
  } ), validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV1 )
138
- .post( '/summaryTable_v1', isAllowedSessionHandler, authorize( {
143
+ .post( '/summaryTable_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
139
144
  userType: [ 'tango', 'client' ], access: [
140
145
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
141
146
  ],
142
147
  } ), validate( validationDtos.validateSummaryTableParams ), summaryTableV1 )
143
- .post( '/footfallTrend_v1', isAllowedSessionHandler, authorize( {
148
+ .post( '/footfallTrend_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
144
149
  userType: [ 'tango', 'client' ], access: [
145
150
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
146
151
  ],
147
152
  } ), validate( validationDtos.validateFootfallTrendParams ), footfallTrendV1 )
148
- .post( '/storeOperation_v1', isAllowedSessionHandler, authorize( {
153
+ .post( '/storeOperation_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
149
154
  userType: [ 'tango', 'client' ], access: [
150
155
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
151
156
  ],
152
157
  } ), validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
153
- .post( '/storesMap_v1', isAllowedSessionHandler, authorize( {
158
+ .post( '/performanceMatrix_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
159
+ userType: [ 'tango', 'client' ], access: [
160
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
161
+ ],
162
+ } ), validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
163
+ .post( '/zoneDwellTimeSplit_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
164
+ userType: [ 'tango', 'client' ], access: [
165
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
166
+ ],
167
+ } ), validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV1 )
168
+ .post( '/storesMap_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
154
169
  userType: [ 'tango', 'client' ], access: [
155
170
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
156
171
  ],
157
172
  } ), validate( validationDtos.validateStoresMapParams ), storesMapV1 )
158
- .post( '/headerLocations_v1', isAllowedSessionHandler, authorize( {
173
+ .post( '/headerLocations_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
159
174
  userType: [ 'tango', 'client' ], access: [
160
175
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
161
176
  ],
162
177
  } ), validate( validationDtos.validateHeaderParams ), headerLocationsV1 )
163
- .post( '/headerGroups_v1', isAllowedSessionHandler, authorize( {
178
+ .post( '/headerGroups_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
164
179
  userType: [ 'tango', 'client' ], access: [
165
180
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
166
181
  ],
167
182
  } ), validate( validationDtos.validateHeaderParams ), headerGroupsV1 )
168
- .post( '/headerStores_v1', isAllowedSessionHandler, authorize( {
183
+ .post( '/headerStores_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
169
184
  userType: [ 'tango', 'client' ], access: [
170
185
  { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
171
186
  ],
172
- } ), validate( validationDtos.validateHeaderParams ), headerStoresV1 );
187
+ } ), validate( validationDtos.validateHeaderParams ), headerStoresV1 )
188
+ .post( '/getMySubscription', isAllowedSessionHandler, validate( validationDtos.getMyProductParams ), getMySubscription )
189
+ .post( '/getStoreMapData', isAllowedSessionHandler, validate( validationDtos.getStoreCameraImageParams ), getStoreMapData );
173
190
 
174
191
  export default analysisTrafficRouter;
@@ -0,0 +1,9 @@
1
+ import model from 'tango-api-schema';
2
+
3
+ export const findCamera = async ( query={}, field={}, sortBy={ updatedAt: -1 } ) => {
4
+ try {
5
+ return await model.cameraModel.findOne( query, field ).sort( sortBy );
6
+ } catch ( error ) {
7
+ return error;
8
+ }
9
+ };
@@ -7,3 +7,11 @@ export function aggregateStore( query ) {
7
7
  return error;
8
8
  }
9
9
  };
10
+
11
+ export const findOneStore = async ( query={}, fields={} ) => {
12
+ try {
13
+ return await model.storeModel.findOne( query, fields );
14
+ } catch ( error ) {
15
+ return error;
16
+ }
17
+ };