tango-app-api-analysis-traffic 3.0.0-alpha.9 → 3.0.0-beta.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.
@@ -6,12 +6,13 @@ const baseSchema = {
6
6
  storeId: joi.array().required().empty(),
7
7
  fromDate: joi.string().required(),
8
8
  toDate: joi.string().required(),
9
+ valueType: joi.string().optional().allow( '' ),
10
+ nob: joi.boolean().optional().allow( '' ),
9
11
  };
10
12
 
11
13
  // Schema for Card Funnel
12
14
  export const validateCardFunnelSchema = joi.object( {
13
15
  ...baseSchema,
14
- valueType: joi.string().required(),
15
16
  } );
16
17
 
17
18
  export const validateCardFunnelParams = {
@@ -21,7 +22,6 @@ export const validateCardFunnelParams = {
21
22
  // Schema for Card Graph (extends baseSchema with additional fields)
22
23
  export const validateCardGraphSchema = joi.object( {
23
24
  ...baseSchema,
24
- valueType: joi.string().required(),
25
25
  dateType: joi.string().required(),
26
26
  } );
27
27
 
@@ -33,6 +33,8 @@ export const validateRecapVideoSchema = joi.object( {
33
33
  clientId: joi.string().required(),
34
34
  storeId: joi.array().required().empty(),
35
35
  recapVideoDate: joi.string().required(),
36
+ valueType: joi.string().optional().allow( '' ),
37
+ nob: joi.boolean().optional().allow( '' ),
36
38
  } );
37
39
 
38
40
  export const validateRecapVideoParams = {
@@ -112,6 +114,8 @@ export const validateFootfallDirectoryFoldersSchema = joi.object( {
112
114
  storeId: joi.array().required().empty(),
113
115
  footfallDate: joi.string().required(),
114
116
  processType: joi.string().required(),
117
+ valueType: joi.string().optional().allow( '' ),
118
+ nob: joi.boolean().optional().allow( '' ),
115
119
  } );
116
120
 
117
121
  export const validateFootfallDirectoryFoldersParams = {
@@ -124,6 +128,8 @@ export const validateFootfallDirectorySchema = joi.object( {
124
128
  footfallDate: joi.string().required(),
125
129
  processType: joi.string().required(),
126
130
  folderName: joi.string().required(),
131
+ valueType: joi.string().optional().allow( '' ),
132
+ nob: joi.boolean().optional().allow( '' ),
127
133
  } );
128
134
 
129
135
  export const validateFootfallDirectoryParams = {
@@ -149,7 +155,7 @@ export const validateFootfallTrendSchema = joi.object( {
149
155
  ...baseSchema,
150
156
  dateType: joi.string().required(),
151
157
  filterBy: joi.string().required(),
152
- processType: joi.string().required(),
158
+ processType: joi.string().optional().allow( '' ),
153
159
  forecast: joi.boolean().optional(),
154
160
  limit: joi.number().required(),
155
161
  offset: joi.number().required(),
@@ -173,6 +179,7 @@ export const validateStoresMapSchema = joi.object( {
173
179
  clientId: joi.string().required(),
174
180
  storeId: joi.array().required().empty(),
175
181
  storeDate: joi.string().required(),
182
+ nob: joi.boolean().optional().allow( '' ),
176
183
  } );
177
184
 
178
185
  export const validateStoresMapParams = {
@@ -195,6 +202,32 @@ export const validateHeaderSchema = joi.object( {
195
202
  group: joi.array().required(),
196
203
  } );
197
204
 
205
+ export const validateHeaderSchemav2 = joi.object( {
206
+ clientId: joi.string().required(),
207
+ city: joi.array().required(),
208
+ clusters: joi.array().required(),
209
+ } );
198
210
  export const validateHeaderParams = {
199
211
  body: validateHeaderSchema,
200
212
  };
213
+ export const validateHeaderParamsv2 = {
214
+ body: validateHeaderSchemav2,
215
+ };
216
+ export const getMyProductSchema = joi.object( {
217
+ clientId: joi.string().required(),
218
+ storeId: joi.array().optional().empty(),
219
+ } );
220
+
221
+ export const getMyProductParams = {
222
+ body: getMyProductSchema,
223
+ };
224
+
225
+ export const getStoreCameraImageSchema = joi.object( {
226
+ clientId: joi.string().required(),
227
+ storeId: joi.array().optional().empty(),
228
+ storeDate: joi.string().required(),
229
+ } );
230
+
231
+ export const getStoreCameraImageParams = {
232
+ body: getStoreCameraImageSchema,
233
+ };
@@ -0,0 +1,106 @@
1
+ import express from 'express';
2
+ import { validate, isAllowedMobileSessionHandler, 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
+ overallChartV1,
12
+ singleStoreChartV1,
13
+ demographicChartV1,
14
+ footfallDirectoryFoldersV1,
15
+ footfallDirectoryV1,
16
+ storeOperationV1,
17
+ zoneDwellTimeSplitV1,
18
+ isAllowedClient,
19
+ getMySubscription,
20
+ buyerChartV1,
21
+ } from '../controllers/mobileTraffic.controllers.js';
22
+
23
+ mobileTrafficAnalysisRouter
24
+ .post( '/cardsFunnel_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
25
+ userType: [ 'tango', 'client' ], access: [
26
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
27
+ ],
28
+ } ), validate( validationDtos.validateCardFunnelParams ), cardsFunnelV1 )
29
+
30
+ .post( '/cardsGraphs_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
31
+ userType: [ 'tango', 'client' ], access: [
32
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
33
+ ],
34
+ } ), validate( validationDtos.validateCardGraphParams ), cardsGraphsV1 )
35
+
36
+ .post( '/recapVideo_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
37
+ userType: [ 'tango', 'client' ], access: [
38
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
39
+ ],
40
+ } ), validate( validationDtos.validateRecapVideoParams ), recapVideoV1 )
41
+
42
+ .post( '/densityDwell_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
43
+ userType: [ 'tango', 'client' ], access: [
44
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
45
+ ],
46
+ } ), validate( validationDtos.validateDensityDwellParams ), densityDwellV1 )
47
+
48
+ .post( '/overallCards_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
49
+ userType: [ 'tango', 'client' ], access: [
50
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
51
+ ],
52
+ } ), validate( validationDtos.validateOverallCharParams ), overallCardsV1 )
53
+
54
+ .post( '/overallChart_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
55
+ userType: [ 'tango', 'client' ], access: [
56
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
57
+ ],
58
+ } ), validate( validationDtos.validateOverallCharParams ), overallChartV1 )
59
+
60
+ .post( '/singleStoreChart_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
61
+ userType: [ 'tango', 'client' ], access: [
62
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
63
+ ],
64
+ } ), validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV1 )
65
+
66
+ .post( '/demographicChart_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
67
+ userType: [ 'tango', 'client' ], access: [
68
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
69
+ ],
70
+ } ), validate( validationDtos.validateDemographicChartParams ), demographicChartV1 )
71
+
72
+ .post( '/buyerChart_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
73
+ userType: [ 'tango', 'client' ], access: [
74
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
75
+ ],
76
+ } ), validate( validationDtos.validateBuyerChartParams ), buyerChartV1 )
77
+
78
+ .post( '/footfallDirectoryFolders_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
79
+ userType: [ 'tango', 'client' ], access: [
80
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
81
+ ],
82
+ } ), validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV1 )
83
+
84
+ .post( '/footfallDirectory_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
85
+ userType: [ 'tango', 'client' ], access: [
86
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
87
+ ],
88
+ } ), validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV1 )
89
+
90
+ .post( '/storeOperation_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
91
+ userType: [ 'tango', 'client' ], access: [
92
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
93
+ ],
94
+ } ), validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
95
+
96
+ .post( '/zoneDwellTimeSplit_v1', isAllowedMobileSessionHandler, isAllowedClient, authorize( {
97
+ userType: [ 'tango', 'client' ], access: [
98
+ { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
99
+ ],
100
+ } ), validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV1 )
101
+
102
+ .post( '/getMySubscription_v1', isAllowedMobileSessionHandler, validate( validationDtos.getMyProductParams ), getMySubscription );
103
+
104
+
105
+ export default mobileTrafficAnalysisRouter;
106
+
@@ -1,5 +1,5 @@
1
1
  import express from 'express';
2
- import { validate, isAllowedSessionHandler, authorize } from 'tango-app-api-middleware';
2
+ import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
3
3
  import * as validationDtos from '../dtos/validation.dtos.js';
4
4
 
5
5
  export const analysisTrafficRouter = express.Router();
@@ -46,11 +46,17 @@ import {
46
46
  footfallTrendV1,
47
47
  storeOperationV1,
48
48
  performanceMatrixV1,
49
+ zoneDwellTimeSplitV1,
49
50
  storesMapV1,
50
51
  headerStoresV1,
51
52
  headerLocationsV1,
52
53
  headerGroupsV1,
53
- isAllowedClient,
54
+ getMySubscription,
55
+ getStoreMapData,
56
+ funnelV1,
57
+ headerStoresV2,
58
+ headerClustersV2,
59
+ headerLocationsV2,
54
60
  } from '../controllers/tangoTrafficV1.controllers.js';
55
61
 
56
62
 
@@ -77,105 +83,33 @@ analysisTrafficRouter
77
83
  .post( '/headerLocations', headerLocations )
78
84
  .post( '/headerGroups', headerGroups )
79
85
  .post( '/headerStores', headerStores )
80
- .post( '/cardsFunnel_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
81
- userType: [ 'tango', 'client' ], access: [
82
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
83
- ],
84
- } ), validate( validationDtos.validateCardFunnelParams ), cardsFunnelV1 )
85
- .post( '/cardsGraphs_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
86
- userType: [ 'tango', 'client' ], access: [
87
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
88
- ],
89
- } ), validate( validationDtos.validateCardGraphParams ), cardsGraphsV1 )
90
- .post( '/recapVideo_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
91
- userType: [ 'tango', 'client' ], access: [
92
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
93
- ],
94
- } ), validate( validationDtos.validateRecapVideoParams ), recapVideoV1 )
95
- .post( '/densityDwell_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
96
- userType: [ 'tango', 'client' ], access: [
97
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
98
- ],
99
- } ), validate( validationDtos.validateDensityDwellParams ), densityDwellV1 )
100
- .post( '/overallCards_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
101
- userType: [ 'tango', 'client' ], access: [
102
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
103
- ],
104
- } ), validate( validationDtos.validateOverallCharParams ), overallCardsV1 )
105
- .post( '/overallHourlyChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
106
- userType: [ 'tango', 'client' ], access: [
107
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
108
- ],
109
- } ), validate( validationDtos.validateOverallCharParams ), overallHourlyChartV1 )
110
- .post( '/overallChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
111
- userType: [ 'tango', 'client' ], access: [
112
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
113
- ],
114
- } ), validate( validationDtos.validateOverallCharParams ), overallChartV1 )
115
- .post( '/singleStoreChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
116
- userType: [ 'tango', 'client' ], access: [
117
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
118
- ],
119
- } ), validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV1 )
120
- .post( '/demographicChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
121
- userType: [ 'tango', 'client' ], access: [
122
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
123
- ],
124
- } ), validate( validationDtos.validateDemographicChartParams ), demographicChartV1 )
125
- .post( '/buyerChart_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
126
- userType: [ 'tango', 'client' ], access: [
127
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
128
- ],
129
- } ), validate( validationDtos.validateBuyerChartParams ), buyerChartV1 )
130
- .post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
131
- userType: [ 'tango', 'client' ], access: [
132
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
133
- ],
134
- } ), validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV1 )
135
- .post( '/footfallDirectory_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
136
- userType: [ 'tango', 'client' ], access: [
137
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
138
- ],
139
- } ), validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV1 )
140
- .post( '/summaryTable_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
141
- userType: [ 'tango', 'client' ], access: [
142
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
143
- ],
144
- } ), validate( validationDtos.validateSummaryTableParams ), summaryTableV1 )
145
- .post( '/footfallTrend_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
146
- userType: [ 'tango', 'client' ], access: [
147
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
148
- ],
149
- } ), validate( validationDtos.validateFootfallTrendParams ), footfallTrendV1 )
150
- .post( '/storeOperation_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
151
- userType: [ 'tango', 'client' ], access: [
152
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
153
- ],
154
- } ), validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
155
- .post( '/performanceMatrix_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
156
- userType: [ 'tango', 'client' ], access: [
157
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
158
- ],
159
- } ), validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
160
- .post( '/storesMap_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
161
- userType: [ 'tango', 'client' ], access: [
162
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
163
- ],
164
- } ), validate( validationDtos.validateStoresMapParams ), storesMapV1 )
165
- .post( '/headerLocations_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
166
- userType: [ 'tango', 'client' ], access: [
167
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
168
- ],
169
- } ), validate( validationDtos.validateHeaderParams ), headerLocationsV1 )
170
- .post( '/headerGroups_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
171
- userType: [ 'tango', 'client' ], access: [
172
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
173
- ],
174
- } ), validate( validationDtos.validateHeaderParams ), headerGroupsV1 )
175
- .post( '/headerStores_v1', isAllowedSessionHandler, isAllowedClient, authorize( {
176
- userType: [ 'tango', 'client' ], access: [
177
- { featureName: 'analytics', name: 'tangoTraffic', permissions: [ 'isView' ] },
178
- ],
179
- } ), validate( validationDtos.validateHeaderParams ), headerStoresV1 );
86
+ .post( '/cardsFunnel_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateCardFunnelParams ), cardsFunnelV1 )
87
+ .post( '/funnel_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateCardFunnelParams ), funnelV1 )
88
+ .post( '/cardsGraphs_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateCardGraphParams ), cardsGraphsV1 )
89
+ .post( '/recapVideo_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateRecapVideoParams ), recapVideoV1 )
90
+ .post( '/densityDwell_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateDensityDwellParams ), densityDwellV1 )
91
+ .post( '/overallCards_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateOverallCharParams ), overallCardsV1 )
92
+ .post( '/overallHourlyChart_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateOverallCharParams ), overallHourlyChartV1 )
93
+ .post( '/overallChart_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateOverallCharParams ), overallChartV1 )
94
+ .post( '/singleStoreChart_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateSingleStoreChartParams ), singleStoreChartV1 )
95
+ .post( '/demographicChart_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateDemographicChartParams ), demographicChartV1 )
96
+ .post( '/buyerChart_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateBuyerChartParams ), buyerChartV1 )
97
+ .post( '/footfallDirectoryFolders_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateFootfallDirectoryFoldersParams ), footfallDirectoryFoldersV1 )
98
+ .post( '/footfallDirectory_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateFootfallDirectoryParams ), footfallDirectoryV1 )
99
+ .post( '/summaryTable_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateSummaryTableParams ), summaryTableV1 )
100
+ .post( '/footfallTrend_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateFootfallTrendParams ), footfallTrendV1 )
101
+ .post( '/storeOperation_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateStoreOperationParams ), storeOperationV1 )
102
+ .post( '/performanceMatrix_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateperformanceMatrixParams ), performanceMatrixV1 )
103
+ .post( '/zoneDwellTimeSplit_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateStoreOperationParams ), zoneDwellTimeSplitV1 )
104
+ .post( '/storesMap_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateStoresMapParams ), storesMapV1 )
105
+ .post( '/headerLocations_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), headerLocationsV1 )
106
+ .post( '/headerGroups_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), headerGroupsV1 )
107
+ .post( '/headerStores_v1', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), headerStoresV1 )
108
+ .post( '/getMySubscription', isAllowedSessionHandler, validate( validationDtos.getMyProductParams ), getMySubscription )
109
+ .post( '/getStoreMapData', isAllowedSessionHandler, validate( validationDtos.getStoreCameraImageParams ), getStoreMapData )
110
+ .post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 )
111
+ .post( '/headercluster_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), getAssinedStore, headerClustersV2 )
112
+ .post( '/headerLocations_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParams ), getAssinedStore, headerLocationsV2 );
113
+
180
114
 
181
115
  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
+ };
@@ -0,0 +1,28 @@
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
+ };
@@ -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
+ };