tango-app-api-infra 3.9.7 → 3.9.9
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 +5 -4
- package/src/controllers/footfallDirectory.controllers.js +5677 -922
- package/src/controllers/infra.controllers.js +34 -21
- package/src/dtos/footfallDirectory.dtos.js +233 -125
- package/src/routes/footfallDirectory.routes.js +22 -6
- package/src/services/storeAccuracyIssues.service.js +9 -0
- package/src/services/vmsStoreRequest.service.js +4 -0
- package/src/validations/footfallDirectory.validation.js +2614 -7
|
@@ -1492,15 +1492,48 @@ export async function allCounts( req, res ) {
|
|
|
1492
1492
|
try {
|
|
1493
1493
|
let date = await getUTC( new Date( req.body.fromDate ), new Date( req.body.toDate ) );
|
|
1494
1494
|
let countQuery = [];
|
|
1495
|
+
const clientConfig = await findOneClient( { clientId: req?.body?.clientId }, { featureConfigs: 1 } );
|
|
1496
|
+
if ( !clientConfig || clientConfig === null ) {
|
|
1497
|
+
return res.sendError( 'client configuration getting error', 400 );
|
|
1498
|
+
}
|
|
1499
|
+
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1500
|
+
let filter = [
|
|
1501
|
+
{
|
|
1502
|
+
terms: {
|
|
1503
|
+
'clientId.keyword': Array.isArray( req?.body?.clientId ) ?
|
|
1504
|
+
req?.body?.clientId :
|
|
1505
|
+
req?.body?.clientId,
|
|
1506
|
+
},
|
|
1507
|
+
},
|
|
1508
|
+
|
|
1509
|
+
{
|
|
1510
|
+
range: {
|
|
1511
|
+
dateString: {
|
|
1512
|
+
gte: req?.body?.fromDate,
|
|
1513
|
+
lte: req?.body?.toDate,
|
|
1514
|
+
format: 'yyyy-MM-dd',
|
|
1515
|
+
},
|
|
1516
|
+
},
|
|
1517
|
+
},
|
|
1518
|
+
];
|
|
1495
1519
|
|
|
1496
1520
|
if ( req.user && req.user.userType === 'client' && req.user.role != 'superadmin' ) {
|
|
1497
1521
|
countQuery.push(
|
|
1498
1522
|
{
|
|
1499
1523
|
$match: {
|
|
1500
|
-
'basicDetails.storeId': { $in: req
|
|
1524
|
+
'basicDetails.storeId': { $in: req?.body?.assignedStores },
|
|
1501
1525
|
},
|
|
1502
1526
|
},
|
|
1503
1527
|
);
|
|
1528
|
+
if ( clientConfig?.featureConfigs?.isVMS === true ) {
|
|
1529
|
+
filter.push( {
|
|
1530
|
+
terms: {
|
|
1531
|
+
'storeId.keyword': Array.isArray( req?.body?.assignedStores ) ?
|
|
1532
|
+
req?.body?.assignedStores :
|
|
1533
|
+
req?.body?.assignedStores,
|
|
1534
|
+
},
|
|
1535
|
+
} );
|
|
1536
|
+
}
|
|
1504
1537
|
}
|
|
1505
1538
|
|
|
1506
1539
|
countQuery.push( {
|
|
@@ -1573,26 +1606,6 @@ export async function allCounts( req, res ) {
|
|
|
1573
1606
|
|
|
1574
1607
|
// get footfall directory ticket
|
|
1575
1608
|
|
|
1576
|
-
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1577
|
-
let filter = [
|
|
1578
|
-
{
|
|
1579
|
-
terms: {
|
|
1580
|
-
'clientId.keyword': Array.isArray( req?.body?.clientId ) ?
|
|
1581
|
-
req?.body?.clientId :
|
|
1582
|
-
req?.body?.clientId,
|
|
1583
|
-
},
|
|
1584
|
-
},
|
|
1585
|
-
|
|
1586
|
-
{
|
|
1587
|
-
range: {
|
|
1588
|
-
dateString: {
|
|
1589
|
-
gte: req?.body?.fromDate,
|
|
1590
|
-
lte: req?.body?.toDate,
|
|
1591
|
-
format: 'yyyy-MM-dd',
|
|
1592
|
-
},
|
|
1593
|
-
},
|
|
1594
|
-
},
|
|
1595
|
-
];
|
|
1596
1609
|
|
|
1597
1610
|
const getCount = {
|
|
1598
1611
|
query: {
|
|
@@ -5,77 +5,26 @@ export const createTicketSchema = Joi.object().keys( {
|
|
|
5
5
|
|
|
6
6
|
dateString: Joi.string().required().custom( ( value, helpers ) => {
|
|
7
7
|
const inputDate = dayjs( value, 'YYYY-MM-DD', true );
|
|
8
|
-
const today = dayjs();
|
|
9
8
|
|
|
10
9
|
if ( !inputDate.isValid() ) {
|
|
11
10
|
return helpers.error( 'any.invalid' );
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const diff = today.diff( inputDate, 'day' );
|
|
15
|
-
|
|
16
|
-
if ( diff > 4 ) {
|
|
17
|
-
return helpers.message( 'Ticket Creation is not allowed for a period exceeding 4 days' );
|
|
18
|
-
}
|
|
19
|
-
|
|
20
13
|
return value;
|
|
21
14
|
} ),
|
|
22
15
|
storeId: Joi.string().required(),
|
|
23
16
|
ticketName: Joi.string().required(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Joi.object( {
|
|
32
|
-
tempId: Joi.number().required(),
|
|
33
|
-
filePath: Joi.string().required(),
|
|
34
|
-
entryTime: Joi.string().required(),
|
|
35
|
-
exitTime: Joi.string().required(),
|
|
36
|
-
timeRange: Joi.string().required(),
|
|
37
|
-
isChecked: Joi.boolean().required(),
|
|
38
|
-
data: Joi.array().items(
|
|
39
|
-
Joi.object( {
|
|
40
|
-
tempId: Joi.number().required(),
|
|
41
|
-
filePath: Joi.string().required(),
|
|
42
|
-
entryTime: Joi.string().required(),
|
|
43
|
-
exitTime: Joi.string().required(),
|
|
44
|
-
timeRange: Joi.string().required(),
|
|
45
|
-
isChecked: Joi.boolean().required(),
|
|
46
|
-
} ),
|
|
47
|
-
).optional(),
|
|
48
|
-
} ) ).optional(),
|
|
49
|
-
|
|
50
|
-
houseKeeping: Joi.array().items( Joi.object( {
|
|
51
|
-
tempId: Joi.number().required(),
|
|
52
|
-
filePath: Joi.string().required(),
|
|
53
|
-
entryTime: Joi.string().required(),
|
|
54
|
-
exitTime: Joi.string().required(),
|
|
55
|
-
timeRange: Joi.string().required(),
|
|
56
|
-
isChecked: Joi.boolean().required(),
|
|
57
|
-
} ) ).optional(),
|
|
58
|
-
|
|
59
|
-
employee: Joi.array().items( Joi.object( {
|
|
60
|
-
tempId: Joi.number().required(),
|
|
61
|
-
filePath: Joi.string().required(),
|
|
62
|
-
entryTime: Joi.string().required(),
|
|
63
|
-
exitTime: Joi.string().required(),
|
|
64
|
-
timeRange: Joi.string().required(),
|
|
65
|
-
isChecked: Joi.boolean().required(),
|
|
66
|
-
|
|
67
|
-
} ) ).optional(),
|
|
68
|
-
|
|
69
|
-
junk: Joi.array().items( Joi.object( {
|
|
70
|
-
tempId: Joi.number().required(),
|
|
71
|
-
filePath: Joi.string().required(),
|
|
72
|
-
entryTime: Joi.string().required(),
|
|
73
|
-
exitTime: Joi.string().required(),
|
|
74
|
-
timeRange: Joi.string().required(),
|
|
75
|
-
isChecked: Joi.boolean().required(),
|
|
76
|
-
|
|
77
|
-
} ) ).optional(),
|
|
17
|
+
comments: Joi.string().optional(),
|
|
18
|
+
type: Joi.string()
|
|
19
|
+
.required()
|
|
20
|
+
.valid( 'create', 'review', 'approve', 'tangRreview' )
|
|
21
|
+
.messages( {
|
|
22
|
+
'any.only': 'type must be one of [create, review, approve, tangRreview]',
|
|
23
|
+
} ),
|
|
78
24
|
|
|
25
|
+
mode: Joi.string().valid( 'mobile', 'web' ).required().messages( {
|
|
26
|
+
'any.only': 'type must be one of [mobile,web]',
|
|
27
|
+
} ),
|
|
79
28
|
|
|
80
29
|
} );
|
|
81
30
|
|
|
@@ -83,9 +32,55 @@ export const createTicketValid = {
|
|
|
83
32
|
body: createTicketSchema,
|
|
84
33
|
};
|
|
85
34
|
|
|
35
|
+
export const tangoReviewTicketSchema = Joi.object().keys( {
|
|
36
|
+
|
|
37
|
+
dateString: Joi.string().required().custom( ( value, helpers ) => {
|
|
38
|
+
const inputDate = dayjs( value, 'YYYY-MM-DD', true );
|
|
39
|
+
|
|
40
|
+
if ( !inputDate.isValid() ) {
|
|
41
|
+
return helpers.error( 'any.invalid' );
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return value;
|
|
45
|
+
} ),
|
|
46
|
+
storeId: Joi.string().required(),
|
|
47
|
+
comments: Joi.string().optional(),
|
|
48
|
+
ticketType: Joi.string().optional(),
|
|
49
|
+
mappingInfo: Joi.object().keys( {
|
|
50
|
+
type: Joi.string().required(),
|
|
51
|
+
mode: Joi.string().required(),
|
|
52
|
+
revicedFootfall: Joi.number().required(),
|
|
53
|
+
revicedPerc: Joi.string().required(),
|
|
54
|
+
count: Joi.array().required(),
|
|
55
|
+
revisedDetail: Joi.array().required(),
|
|
56
|
+
createdByEmail: Joi.string().optional(),
|
|
57
|
+
createdByUserName: Joi.string().optional(),
|
|
58
|
+
createdByRole: Joi.string().optional(),
|
|
59
|
+
status: Joi.string().optional(),
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
} ).required(),
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
export const tangoReviewTicketValid = {
|
|
66
|
+
body: tangoReviewTicketSchema,
|
|
67
|
+
};
|
|
68
|
+
export const tangoReviewAccuracyClosedTicketSchema = Joi.object().keys( {
|
|
69
|
+
storeId: Joi.string().required(),
|
|
70
|
+
dateString: Joi.string().required(),
|
|
71
|
+
comments: Joi.string().required(),
|
|
72
|
+
subComment: Joi.string().required(),
|
|
73
|
+
|
|
74
|
+
} );
|
|
75
|
+
|
|
76
|
+
export const tangoReviewAccuracyClosedTicketValid = {
|
|
77
|
+
body: tangoReviewAccuracyClosedTicketSchema,
|
|
78
|
+
};
|
|
79
|
+
|
|
86
80
|
export const ticketSummarySchema = Joi.object().keys( {
|
|
87
81
|
clientId: Joi.string().required(),
|
|
88
|
-
|
|
82
|
+
tangoType: Joi.string().valid( 'store', 'internal' ).optional(),
|
|
83
|
+
permissionType: Joi.string().valid( 'approve', 'review' ).optional(),
|
|
89
84
|
fromDate: Joi.string()
|
|
90
85
|
.pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
|
|
91
86
|
.required()
|
|
@@ -153,7 +148,19 @@ export const ticketListSchema = Joi.object().keys( {
|
|
|
153
148
|
offset: Joi.number().optional(),
|
|
154
149
|
isExport: Joi.boolean().optional(),
|
|
155
150
|
sortBy: Joi.string().optional().allow( '' ),
|
|
151
|
+
status: Joi.string().optional(),
|
|
156
152
|
sortOrder: Joi.number().valid( -1, 1 ).optional(),
|
|
153
|
+
tangoType: Joi.string().valid( 'store', 'internal', '' ).optional(),
|
|
154
|
+
permissionType: Joi.string().valid( 'review', 'approve' ).optional(),
|
|
155
|
+
filterByStatus: Joi.string().optional().allow( '' ),
|
|
156
|
+
filterByStore: Joi.string().optional().allow( '' ),
|
|
157
|
+
filterByReviewer: Joi.string().optional().allow( '' ),
|
|
158
|
+
filterByApprover: Joi.string().optional().allow( '' ),
|
|
159
|
+
filterByTango: Joi.string().optional().allow( '' ),
|
|
160
|
+
filterByReviewedBy: Joi.string().optional().allow( '' ),
|
|
161
|
+
fileterByApprovedBy: Joi.string().optional().allow( '' ),
|
|
162
|
+
filterByTicketType: Joi.string().optional().allow( '' ),
|
|
163
|
+
filterByTangoStatus: Joi.string().optional().allow( '' ),
|
|
157
164
|
fromDate: Joi.string()
|
|
158
165
|
.pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
|
|
159
166
|
.required()
|
|
@@ -213,89 +220,85 @@ export const ticketListValid = {
|
|
|
213
220
|
};
|
|
214
221
|
|
|
215
222
|
export const getTicketsSchema = Joi.object().keys( {
|
|
216
|
-
storeId: Joi.string().required().allow( '' ),
|
|
217
|
-
dateString: Joi.string().
|
|
218
|
-
fromDate: Joi.string()
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
toDate: Joi.string()
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
223
|
+
// storeId: Joi.string().required().allow( '' ),
|
|
224
|
+
// dateString: Joi.string().required(),
|
|
225
|
+
// fromDate: Joi.string()
|
|
226
|
+
// .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
|
|
227
|
+
// .required()
|
|
228
|
+
// .messages( {
|
|
229
|
+
// 'string.pattern.name': `'fromDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
|
|
230
|
+
// 'string.empty': `'fromDate' is required.`,
|
|
231
|
+
// } )
|
|
232
|
+
// .custom( ( value, helpers ) => {
|
|
233
|
+
// const from = dayjs( value );
|
|
234
|
+
// if ( !from.isValid() ) {
|
|
235
|
+
// return helpers.error( 'any.invalid', { message: 'Invalid fromDate' } );
|
|
236
|
+
// }
|
|
237
|
+
// return value;
|
|
238
|
+
// } ),
|
|
239
|
+
|
|
240
|
+
// toDate: Joi.string()
|
|
241
|
+
// .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
|
|
242
|
+
// .required()
|
|
243
|
+
// .messages( {
|
|
244
|
+
// 'string.pattern.name': `'toDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
|
|
245
|
+
// 'string.empty': `'toDate' is required.`,
|
|
246
|
+
// } )
|
|
247
|
+
// .custom( ( value, helpers ) => {
|
|
248
|
+
// const to = dayjs( value );
|
|
249
|
+
// const today = dayjs();
|
|
250
|
+
|
|
251
|
+
// if ( !to.isValid() ) {
|
|
252
|
+
// return helpers.error( 'any.invalid', { message: 'Invalid toDate' } );
|
|
253
|
+
// }
|
|
254
|
+
// if ( to.isAfter( today, 'day' ) ) {
|
|
255
|
+
// return helpers.error( 'any.invalid', { message: 'toDate cannot be in the future' } );
|
|
256
|
+
// }
|
|
257
|
+
|
|
258
|
+
// return value;
|
|
259
|
+
// } ),
|
|
260
|
+
ticketId: Joi.string().required(),
|
|
261
|
+
// status: Joi.string().optional(),
|
|
262
|
+
action: Joi.string().optional().allow( '' ),
|
|
263
|
+
// revopsType: Joi.string().optional(),
|
|
264
|
+
// limit: Joi.number().required(),
|
|
265
|
+
// offset: Joi.number().optional(),
|
|
258
266
|
|
|
259
|
-
} )
|
|
260
|
-
|
|
261
|
-
|
|
267
|
+
} );
|
|
268
|
+
// .custom( ( value, helpers ) => {
|
|
269
|
+
// const from = dayjs( value.fromDate );
|
|
270
|
+
// const to = dayjs( value.toDate );
|
|
262
271
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
272
|
+
// if ( !from.isValid() || !to.isValid() ) {
|
|
273
|
+
// return helpers.error( 'any.invalid', { message: 'Invalid dates' } );
|
|
274
|
+
// }
|
|
266
275
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
276
|
+
// if ( from.isAfter( to ) ) {
|
|
277
|
+
// return helpers.error( 'any.invalid', { message: 'fromDate cannot be after toDate' } );
|
|
278
|
+
// }
|
|
270
279
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
280
|
+
// if ( to.diff( from, 'day' ) > 90 ) {
|
|
281
|
+
// return helpers.error( 'any.invalid', { message: 'Date range cannot exceed 90 days' } );
|
|
282
|
+
// }
|
|
274
283
|
|
|
275
|
-
|
|
276
|
-
} );
|
|
284
|
+
// return value;
|
|
285
|
+
// } );
|
|
277
286
|
|
|
278
287
|
export const getTicketsValid = {
|
|
279
288
|
query: getTicketsSchema,
|
|
280
289
|
};
|
|
281
290
|
|
|
282
|
-
export const updateStatusSchemea =Joi.object().keys( {
|
|
291
|
+
export const updateStatusSchemea = Joi.object().keys( {
|
|
283
292
|
data: Joi.array().items(
|
|
284
293
|
Joi.object( {
|
|
285
294
|
_id: Joi.string().required(),
|
|
286
295
|
dateString: Joi.string().required().custom( ( value, helpers ) => {
|
|
287
296
|
const inputDate = dayjs( value, 'YYYY-MM-DD', true );
|
|
288
|
-
const today = dayjs();
|
|
289
297
|
|
|
290
298
|
if ( !inputDate.isValid() ) {
|
|
291
299
|
return helpers.error( 'any.invalid' );
|
|
292
300
|
}
|
|
293
301
|
|
|
294
|
-
const diff = today.diff( inputDate, 'day' );
|
|
295
|
-
|
|
296
|
-
if ( diff > 7 ) {
|
|
297
|
-
return helpers.message( 'Approval is not allowed for a period exceeding 7 days' );
|
|
298
|
-
}
|
|
299
302
|
|
|
300
303
|
return value;
|
|
301
304
|
} ),
|
|
@@ -498,3 +501,108 @@ export const downloadTicketsSchema = Joi.object().keys( {
|
|
|
498
501
|
export const downloadTicketsValid = {
|
|
499
502
|
query: downloadTicketsSchema,
|
|
500
503
|
};
|
|
504
|
+
|
|
505
|
+
export const reviewerListSchema = Joi.object().keys( {
|
|
506
|
+
clientId: Joi.string().required(),
|
|
507
|
+
tangotype: Joi.string().optional().allow( '' ),
|
|
508
|
+
type: Joi.string().required().allow( 'approve', 'review' ),
|
|
509
|
+
} );
|
|
510
|
+
|
|
511
|
+
export const reviewerListValid = {
|
|
512
|
+
query: reviewerListSchema,
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
export const openTicketListSchema = Joi.object().keys( {
|
|
516
|
+
fromDate: Joi.string().required(),
|
|
517
|
+
toDate: Joi.string().required(),
|
|
518
|
+
clientId: Joi.array().items(
|
|
519
|
+
Joi.string().required(),
|
|
520
|
+
).required(),
|
|
521
|
+
type: Joi.string().required().allow( 'review', 'approve' ),
|
|
522
|
+
sortOrder: Joi.number().valid( 1, -1 ).optional(),
|
|
523
|
+
searchValue: Joi.string().allow( '' ).optional(),
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
} );
|
|
527
|
+
|
|
528
|
+
export const openTicketListValid = {
|
|
529
|
+
body: openTicketListSchema,
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
export const assignTicketSchema = Joi.object().keys( {
|
|
534
|
+
email: Joi.string().required(),
|
|
535
|
+
userName: Joi.string().optional(),
|
|
536
|
+
role: Joi.string().optional(),
|
|
537
|
+
actionType: Joi.string().required(),
|
|
538
|
+
storeId: Joi.string().required(),
|
|
539
|
+
dateString: Joi.string().required(),
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
} );
|
|
543
|
+
|
|
544
|
+
export const assignTicketValid = {
|
|
545
|
+
body: assignTicketSchema,
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
export const updateTempStatusSchema = Joi.object().keys( {
|
|
549
|
+
id: Joi.array().items( Joi.string().required() ).required(),
|
|
550
|
+
status: Joi.string().required(),
|
|
551
|
+
type: Joi.string().required().allow( 'review', 'approve' ),
|
|
552
|
+
comments: Joi.string().optional().allow( '' ),
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
} );
|
|
556
|
+
|
|
557
|
+
export const updateTempStatusValid = {
|
|
558
|
+
body: updateTempStatusSchema,
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
export const updateTicketStatusSchema = Joi.object().keys( {
|
|
562
|
+
storeId: Joi.string().required(),
|
|
563
|
+
dateString: Joi.string().required(),
|
|
564
|
+
mode: Joi.string().required(),
|
|
565
|
+
|
|
566
|
+
} );
|
|
567
|
+
|
|
568
|
+
export const updateTicketStatusValid = {
|
|
569
|
+
body: updateTicketStatusSchema,
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
export const multiCloseTicketSchema = Joi.object().keys( {
|
|
573
|
+
|
|
574
|
+
ticketList: Joi.array().items( Joi.object().keys( {
|
|
575
|
+
storeId: Joi.string().required(),
|
|
576
|
+
dateString: Joi.string().required(),
|
|
577
|
+
} ) ),
|
|
578
|
+
mode: Joi.string().required(),
|
|
579
|
+
|
|
580
|
+
} );
|
|
581
|
+
|
|
582
|
+
export const multiCloseTicketValid = {
|
|
583
|
+
body: multiCloseTicketSchema,
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
export const getAccuracyIssuesSchema = Joi.object().keys( {
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
clientId: Joi.string().required(),
|
|
591
|
+
|
|
592
|
+
} );
|
|
593
|
+
|
|
594
|
+
export const getAccuracyIssuesValid = {
|
|
595
|
+
query: getAccuracyIssuesSchema,
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
export const updateAccuracyIssuesSchema = Joi.object().keys( {
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
clientId: Joi.string().required(),
|
|
602
|
+
issueName: Joi.string().required(),
|
|
603
|
+
|
|
604
|
+
} );
|
|
605
|
+
|
|
606
|
+
export const updateAccuracyIssuesValid = {
|
|
607
|
+
query: updateAccuracyIssuesSchema,
|
|
608
|
+
};
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import { getClusters,
|
|
3
|
-
import { createTicket, downloadTickets, getTaggedStores, getTickets, ticketList, ticketSummary, updateStatus } from '../controllers/footfallDirectory.controllers.js';
|
|
4
|
-
import { createTicketValid, downloadTicketsValid, getTaggedStoresValid, getTicketsValid, ticketListValid, ticketSummaryValid, updateStatusValid } from '../dtos/footfallDirectory.dtos.js';
|
|
2
|
+
import { getClusters, getConfig, isGrantedUsers, isTicketExists, ticketApprove, ticketCreation, ticketReview } from '../validations/footfallDirectory.validation.js';
|
|
3
|
+
import { assignTicket, createTicket, downloadTickets, getTaggedStores, getTickets, multiCloseTicket, openTicketList, reviewerList, tangoReviewTicket, ticketList, ticketSummary, updateStatus, updateTempStatus, updateUserTicketStatus, createinternalTicket, checkTicketExists, tangoReviewAccuracyClosedTicket, getAccuracyIssues, updateAccuracyIssues } from '../controllers/footfallDirectory.controllers.js';
|
|
4
|
+
import { createTicketValid, downloadTicketsValid, getTaggedStoresValid, getTicketsValid, openTicketListValid, reviewerListValid, ticketListValid, ticketSummaryValid, updateStatusValid, assignTicketValid, updateTempStatusValid, updateTicketStatusValid, tangoReviewTicketValid, multiCloseTicketValid, tangoReviewAccuracyClosedTicketValid, getAccuracyIssuesValid, updateAccuracyIssuesValid } from '../dtos/footfallDirectory.dtos.js';
|
|
5
5
|
import { bulkValidate, getAssinedStore, isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
6
6
|
|
|
7
7
|
export const footfallDirectoryRouter = express.Router();
|
|
8
8
|
|
|
9
|
-
footfallDirectoryRouter.post( '/create-ticket', isAllowedSessionHandler, validate( createTicketValid ),
|
|
10
|
-
footfallDirectoryRouter.
|
|
9
|
+
footfallDirectoryRouter.post( '/create-ticket', isAllowedSessionHandler, validate( createTicketValid ), isGrantedUsers, getConfig, ticketCreation, ticketReview, ticketApprove, createTicket );
|
|
10
|
+
footfallDirectoryRouter.post( '/create-internalticket', isAllowedSessionHandler, createinternalTicket );
|
|
11
|
+
footfallDirectoryRouter.post( '/checkTicketExists', isAllowedSessionHandler, checkTicketExists );
|
|
11
12
|
|
|
12
|
-
footfallDirectoryRouter.
|
|
13
|
+
footfallDirectoryRouter.post( '/tango-review-ticket', isAllowedSessionHandler, validate( tangoReviewTicketValid ), tangoReviewTicket );
|
|
14
|
+
footfallDirectoryRouter.post( '/tango-review-accuracy-ticket', isAllowedSessionHandler, validate( tangoReviewAccuracyClosedTicketValid ), tangoReviewAccuracyClosedTicket );
|
|
15
|
+
|
|
16
|
+
footfallDirectoryRouter.get( '/ticket-summary', isAllowedSessionHandler, bulkValidate( ticketSummaryValid ), getAssinedStore, ticketSummary );
|
|
17
|
+
|
|
18
|
+
footfallDirectoryRouter.get( '/ticket-list', isAllowedSessionHandler, bulkValidate( ticketListValid ), getAssinedStore, ticketList );
|
|
13
19
|
footfallDirectoryRouter.get( '/get-tickets', isAllowedSessionHandler, bulkValidate( getTicketsValid ), getTickets );
|
|
14
20
|
footfallDirectoryRouter.get( '/get-tagged-stores', isAllowedSessionHandler, bulkValidate( getTaggedStoresValid ), getAssinedStore, getClusters, getTaggedStores );
|
|
15
21
|
footfallDirectoryRouter.put( '/update-status', isAllowedSessionHandler, bulkValidate( updateStatusValid ), updateStatus );
|
|
16
22
|
footfallDirectoryRouter.get( '/download-tickets', isAllowedSessionHandler, bulkValidate( downloadTicketsValid ), isTicketExists, downloadTickets );
|
|
23
|
+
footfallDirectoryRouter.get( '/reviewer-list', isAllowedSessionHandler, bulkValidate( reviewerListValid ), reviewerList );
|
|
24
|
+
footfallDirectoryRouter.post( '/open-ticket-list', isAllowedSessionHandler, bulkValidate( openTicketListValid ), getAssinedStore, openTicketList );
|
|
25
|
+
footfallDirectoryRouter.post( '/assign-ticket', isAllowedSessionHandler, bulkValidate( assignTicketValid ), assignTicket );
|
|
26
|
+
footfallDirectoryRouter.post( '/update-temp-status', isAllowedSessionHandler, bulkValidate( updateTempStatusValid ), updateTempStatus );
|
|
27
|
+
footfallDirectoryRouter.post( '/update-ticket-status', isAllowedSessionHandler, bulkValidate( updateTicketStatusValid ), updateUserTicketStatus );
|
|
28
|
+
footfallDirectoryRouter.post( '/multi-close-tickets', isAllowedSessionHandler, bulkValidate( multiCloseTicketValid ), multiCloseTicket );
|
|
29
|
+
|
|
30
|
+
footfallDirectoryRouter.get( '/get-accuarcy-issues', isAllowedSessionHandler, bulkValidate( getAccuracyIssuesValid ), getAccuracyIssues );
|
|
31
|
+
footfallDirectoryRouter.put( '/update-accuarcy-issues', isAllowedSessionHandler, bulkValidate( updateAccuracyIssuesValid ), updateAccuracyIssues );
|
|
32
|
+
|
|
17
33
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import storeAccuracyIssuesModel from 'tango-api-schema/schema/storeAccuracyIssues.model.js';
|
|
2
|
+
|
|
3
|
+
export async function findStoreAccuracIssues( query, fiels ) {
|
|
4
|
+
return await storeAccuracyIssuesModel.find( query, fiels );
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export async function upsertStoreAccuracIssues( query, record ) {
|
|
8
|
+
return await storeAccuracyIssuesModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
9
|
+
}
|