tango-app-api-audit 3.4.0-alpha.18 → 3.4.0-alpha.19
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
|
@@ -198,8 +198,8 @@ export async function getAuditFile( req, res ) {
|
|
|
198
198
|
const bucket = JSON.parse( process.env.BUCKET );
|
|
199
199
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
200
200
|
const inputData = req.query;
|
|
201
|
-
const previousDate = new Date(new Date() - 1);
|
|
202
|
-
const data = await getDate(previousDate, new Date() );
|
|
201
|
+
const previousDate = new Date( new Date() - 1 );
|
|
202
|
+
const data = await getDate( previousDate, new Date() );
|
|
203
203
|
logger.info( { data: data, function: 'data', newDate: new Date() } );
|
|
204
204
|
logger.info( { userId: req.user._id, queueName: inputData.queueName, moduleType: inputData.moduleType } );
|
|
205
205
|
const start = data.start;
|
|
@@ -754,7 +754,7 @@ export async function workSpace( req, res ) {
|
|
|
754
754
|
const filter =[
|
|
755
755
|
{ status: { $in: [ 'active', 'hold' ] } },
|
|
756
756
|
{ 'auditConfigs.audit': { $eq: true } },
|
|
757
|
-
{ clientId: { $in: inputData.clientId } }
|
|
757
|
+
{ clientId: { $in: inputData.clientId } },
|
|
758
758
|
];
|
|
759
759
|
|
|
760
760
|
const temp = [];
|
|
@@ -808,7 +808,7 @@ export async function workSpace( req, res ) {
|
|
|
808
808
|
|
|
809
809
|
const clientDetails = await aggregateClient( clientQuery );
|
|
810
810
|
const clientList = clientDetails.map( ( i ) => i.clientId );
|
|
811
|
-
const fileDate = dayjs( dateRange.start ).subtract( 1, 'days' );
|
|
811
|
+
const fileDate = dayjs( dateRange.start ).subtract( 1, 'days' ); // dayjs( dateRange.start );
|
|
812
812
|
const getStoreData = await findOneStoreData(
|
|
813
813
|
{},
|
|
814
814
|
{ fileDate: 1 },
|
|
@@ -1456,7 +1456,7 @@ export async function userAuditHistory( req, res ) {
|
|
|
1456
1456
|
{
|
|
1457
1457
|
moduleType: { $eq: inputData.moduleType },
|
|
1458
1458
|
},
|
|
1459
|
-
{ clientId: { $in: inputData.clientId } }
|
|
1459
|
+
{ clientId: { $in: inputData.clientId } },
|
|
1460
1460
|
];
|
|
1461
1461
|
|
|
1462
1462
|
if ( inputData.dateType == 'fileDate' ) {
|
|
@@ -1924,7 +1924,7 @@ export async function storeMetrics( req, res ) {
|
|
|
1924
1924
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
1925
1925
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
1926
1926
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
1927
|
-
{ clientId: { $in: inputData.filterByClientId } }
|
|
1927
|
+
{ clientId: { $in: inputData.filterByClientId } },
|
|
1928
1928
|
|
|
1929
1929
|
];
|
|
1930
1930
|
|
|
@@ -2478,7 +2478,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2478
2478
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2479
2479
|
{ auditStatus: { $ne: 'completed' } },
|
|
2480
2480
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
2481
|
-
{ clientId: { $in: inputData.clientId }},
|
|
2481
|
+
{ clientId: { $in: inputData.clientId } },
|
|
2482
2482
|
|
|
2483
2483
|
];
|
|
2484
2484
|
|
|
@@ -2662,8 +2662,8 @@ export async function overAllAuditSummary( req, res ) {
|
|
|
2662
2662
|
let filters =[
|
|
2663
2663
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2664
2664
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2665
|
-
{ moduleType: { $eq: inputData.moduleType }},
|
|
2666
|
-
{ clientId: { $in: inputData.clientId } }
|
|
2665
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
2666
|
+
{ clientId: { $in: inputData.clientId } },
|
|
2667
2667
|
];
|
|
2668
2668
|
|
|
2669
2669
|
const storeQuery = inputData.clientId.length? { 'edge.firstFile': true, 'clientId': { $in: inputData. clientId } } : { 'edge.firstFile': true };
|
|
@@ -2925,7 +2925,7 @@ export async function overViewCard( req, res ) {
|
|
|
2925
2925
|
let filters =[
|
|
2926
2926
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2927
2927
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2928
|
-
{ clientId: { $in: inputData.clientId } }
|
|
2928
|
+
{ clientId: { $in: inputData.clientId } },
|
|
2929
2929
|
];
|
|
2930
2930
|
|
|
2931
2931
|
const query =[
|
|
@@ -3082,7 +3082,7 @@ export async function summarySplit( req, res ) {
|
|
|
3082
3082
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3083
3083
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3084
3084
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
3085
|
-
{ clientId: { $in: inputData.clientId } }
|
|
3085
|
+
{ clientId: { $in: inputData.clientId } },
|
|
3086
3086
|
];
|
|
3087
3087
|
|
|
3088
3088
|
const query =[
|
|
@@ -3195,7 +3195,7 @@ export async function overviewTable( req, res ) {
|
|
|
3195
3195
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3196
3196
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3197
3197
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
3198
|
-
{ clientId: { $in: inputData.clientId } }
|
|
3198
|
+
{ clientId: { $in: inputData.clientId } },
|
|
3199
3199
|
|
|
3200
3200
|
];
|
|
3201
3201
|
|
|
@@ -18,7 +18,7 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
18
18
|
const bucket = JSON.parse( process.env.BUCKET );
|
|
19
19
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
20
20
|
const inputData = req.query;
|
|
21
|
-
const previousDate = new Date(new Date() - 1);
|
|
21
|
+
const previousDate = new Date( new Date() - 1 );
|
|
22
22
|
const data = await getDate( previousDate, new Date() );
|
|
23
23
|
logger.info( { data: data, function: 'data', newDate: new Date() } );
|
|
24
24
|
logger.info( { userId: req.user._id, queueName: inputData.queueName, moduleType: inputData.moduleType } );
|
|
@@ -472,7 +472,7 @@ export async function workSpace( req, res ) {
|
|
|
472
472
|
const filter =[
|
|
473
473
|
{ status: { $in: [ 'active', 'hold' ] } },
|
|
474
474
|
{ 'auditConfigs.audit': { $eq: true } },
|
|
475
|
-
{ clientId: { $in: inputData.clientId } }
|
|
475
|
+
{ clientId: { $in: inputData.clientId } },
|
|
476
476
|
];
|
|
477
477
|
|
|
478
478
|
const temp = [];
|
|
@@ -903,7 +903,7 @@ export async function getAuditFile( req, res ) {
|
|
|
903
903
|
try {
|
|
904
904
|
const inputData = req.query;
|
|
905
905
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
906
|
-
const previousDate = new Date(new Date() - 1);
|
|
906
|
+
const previousDate = new Date( new Date() - 1 );
|
|
907
907
|
const data = await getDate( previousDate, new Date() );
|
|
908
908
|
const start = data.start;
|
|
909
909
|
const end = data.end;
|
|
@@ -1497,7 +1497,7 @@ export async function userAuditHistory( req, res ) {
|
|
|
1497
1497
|
let filter = [
|
|
1498
1498
|
{ userId: { $eq: userId } },
|
|
1499
1499
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
1500
|
-
{ clientId: { $in: inputData.clientId } }
|
|
1500
|
+
{ clientId: { $in: inputData.clientId } },
|
|
1501
1501
|
];
|
|
1502
1502
|
|
|
1503
1503
|
if ( inputData.dateType == 'fileDate' ) {
|
|
@@ -2005,7 +2005,7 @@ export async function storeMetrics( req, res ) {
|
|
|
2005
2005
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
2006
2006
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2007
2007
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
2008
|
-
{ clientId: { $in: inputData.filterByClientId } }
|
|
2008
|
+
{ clientId: { $in: inputData.filterByClientId } },
|
|
2009
2009
|
|
|
2010
2010
|
];
|
|
2011
2011
|
|
|
@@ -2812,7 +2812,7 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
2812
2812
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
2813
2813
|
{ auditStatus: { $ne: 'completed' } },
|
|
2814
2814
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
2815
|
-
{ clientId: { $in: inputData.clientId } }
|
|
2815
|
+
{ clientId: { $in: inputData.clientId } },
|
|
2816
2816
|
|
|
2817
2817
|
];
|
|
2818
2818
|
|
|
@@ -3014,8 +3014,8 @@ export async function overAllAuditSummary( req, res ) {
|
|
|
3014
3014
|
let filters =[
|
|
3015
3015
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3016
3016
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3017
|
-
{ moduleType: { $eq: inputData.moduleType }},
|
|
3018
|
-
{ clientId: { $in: inputData.clientId } }
|
|
3017
|
+
{ moduleType: { $eq: inputData.moduleType } },
|
|
3018
|
+
{ clientId: { $in: inputData.clientId } },
|
|
3019
3019
|
];
|
|
3020
3020
|
|
|
3021
3021
|
const storeQuery = inputData.clientId.length? { 'edge.firstFile': true, 'clientId': { $in: inputData. clientId } } : { 'edge.firstFile': true };
|
|
@@ -3181,7 +3181,7 @@ export async function summarySplit( req, res ) {
|
|
|
3181
3181
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3182
3182
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3183
3183
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
3184
|
-
{ clientId: { $in: inputData.clientId } }
|
|
3184
|
+
{ clientId: { $in: inputData.clientId } },
|
|
3185
3185
|
];
|
|
3186
3186
|
|
|
3187
3187
|
const query =[
|
|
@@ -3294,7 +3294,7 @@ export async function overviewTable( req, res ) {
|
|
|
3294
3294
|
{ fileDateISO: { $gte: dateRange.start } },
|
|
3295
3295
|
{ fileDateISO: { $lte: dateRange.end } },
|
|
3296
3296
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
3297
|
-
{ clientId: { $in: inputData.clientId } }
|
|
3297
|
+
{ clientId: { $in: inputData.clientId } },
|
|
3298
3298
|
|
|
3299
3299
|
];
|
|
3300
3300
|
|
package/src/dtos/audit.dtos.js
CHANGED
|
@@ -14,7 +14,7 @@ export const clientValid = {
|
|
|
14
14
|
|
|
15
15
|
// store
|
|
16
16
|
export const auditStoreSchema = joi.object( {
|
|
17
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
17
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
18
18
|
limit: joi.number().optional(),
|
|
19
19
|
offset: joi.number().optional(),
|
|
20
20
|
} );
|
|
@@ -107,7 +107,7 @@ export const saveValid = {
|
|
|
107
107
|
export const workSpaceSchema = joi.object( {
|
|
108
108
|
searchValue: joi.string().optional().allow( '' ),
|
|
109
109
|
moduleType: joi.string().required(),
|
|
110
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
110
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
111
111
|
offset: joi.number().optional(),
|
|
112
112
|
limit: joi.number().optional(),
|
|
113
113
|
isExport: joi.boolean().optional(),
|
|
@@ -126,7 +126,7 @@ export const userAuditHistorySchema = joi.object( {
|
|
|
126
126
|
fromDate: joi.string().required(),
|
|
127
127
|
toDate: joi.string().required(),
|
|
128
128
|
dateType: joi.string().required(),
|
|
129
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
129
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
130
130
|
filterByStoreId: joi.array().required(),
|
|
131
131
|
moduleType: joi.string().required(),
|
|
132
132
|
filterByAuditType: joi.array().optional(),
|
|
@@ -165,7 +165,7 @@ export const storeMetricsSchema = joi.object( {
|
|
|
165
165
|
fromDate: joi.string().required(),
|
|
166
166
|
toDate: joi.string().required(),
|
|
167
167
|
searchValue: joi.string().optional().allow( '' ),
|
|
168
|
-
filterByClientId: joi.array().items( joi.string().required() ).required(),
|
|
168
|
+
filterByClientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
169
169
|
filterByStoreId: joi.array().optional(),
|
|
170
170
|
filterByStatus: joi.array().optional(),
|
|
171
171
|
filterByAuditType: joi.array().optional(),
|
|
@@ -203,7 +203,7 @@ export const userMetricsValid = {
|
|
|
203
203
|
export const pendingSummaryTableSchema = joi.object( {
|
|
204
204
|
fromDate: joi.string().required(),
|
|
205
205
|
toDate: joi.string().required(),
|
|
206
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
206
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
207
207
|
limit: joi.number().optional(),
|
|
208
208
|
offset: joi.number().optional(),
|
|
209
209
|
searchValue: joi.string().optional().allow( '' ),
|
|
@@ -222,7 +222,7 @@ export const pendingSummaryTableValid = {
|
|
|
222
222
|
export const overviewTableSchema = joi.object( {
|
|
223
223
|
fromDate: joi.string().required(),
|
|
224
224
|
toDate: joi.string().required(),
|
|
225
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
225
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
226
226
|
limit: joi.number().optional(),
|
|
227
227
|
offset: joi.number().optional(),
|
|
228
228
|
searchValue: joi.string().optional().allow( '' ),
|
|
@@ -241,7 +241,7 @@ export const overviewTableValid = {
|
|
|
241
241
|
export const overAllAuditSummarySchema = joi.object( {
|
|
242
242
|
fromDate: joi.string().required(),
|
|
243
243
|
toDate: joi.string().required(),
|
|
244
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
244
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
245
245
|
moduleType: joi.string().required(),
|
|
246
246
|
} );
|
|
247
247
|
|
|
@@ -278,7 +278,7 @@ export const overViewCardValid = {
|
|
|
278
278
|
export const summarySplitSchema = joi.object( {
|
|
279
279
|
fromDate: joi.string().required(),
|
|
280
280
|
toDate: joi.string().required(),
|
|
281
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
281
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
282
282
|
moduleType: joi.string().required(),
|
|
283
283
|
} );
|
|
284
284
|
|
|
@@ -101,7 +101,7 @@ export const workSpaceSchema = joi.object(
|
|
|
101
101
|
{
|
|
102
102
|
searchValue: joi.string().optional().allow( '' ),
|
|
103
103
|
moduleType: joi.string().required(),
|
|
104
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
104
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
105
105
|
offset: joi.number().optional(),
|
|
106
106
|
limit: joi.number().optional(),
|
|
107
107
|
isExport: joi.boolean().optional(),
|
|
@@ -120,7 +120,7 @@ export const userAuditHistorySchema = joi.object(
|
|
|
120
120
|
fromDate: joi.string().required(),
|
|
121
121
|
toDate: joi.string().required(),
|
|
122
122
|
dateType: joi.string().required(),
|
|
123
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
123
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
124
124
|
filterByStoreId: joi.array().required(),
|
|
125
125
|
moduleType: joi.string().required(),
|
|
126
126
|
filterByAuditType: joi.array().optional(),
|
|
@@ -164,7 +164,7 @@ export const storeMetricsSchema = joi.object(
|
|
|
164
164
|
fromDate: joi.string().required(),
|
|
165
165
|
toDate: joi.string().required(),
|
|
166
166
|
searchValue: joi.string().optional().allow( '' ),
|
|
167
|
-
filterByClientId: joi.array().items( joi.string().required() ).required(),
|
|
167
|
+
filterByClientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
168
168
|
filterByStoreId: joi.array().optional(),
|
|
169
169
|
filterByStatus: joi.array().optional(),
|
|
170
170
|
filterByAuditType: joi.array().optional(),
|
|
@@ -205,7 +205,7 @@ export const pendingSummaryTableSchema = joi.object(
|
|
|
205
205
|
{
|
|
206
206
|
fromDate: joi.string().required(),
|
|
207
207
|
toDate: joi.string().required(),
|
|
208
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
208
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
209
209
|
limit: joi.number().optional(),
|
|
210
210
|
offset: joi.number().optional(),
|
|
211
211
|
searchValue: joi.string().optional().allow( '' ),
|
|
@@ -226,7 +226,7 @@ export const overAllAuditSummarySchema = joi.object(
|
|
|
226
226
|
{
|
|
227
227
|
fromDate: joi.string().required(),
|
|
228
228
|
toDate: joi.string().required(),
|
|
229
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
229
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
230
230
|
moduleType: joi.string().required(),
|
|
231
231
|
},
|
|
232
232
|
);
|
|
@@ -239,7 +239,7 @@ export const summarySplitSchema = joi.object(
|
|
|
239
239
|
{
|
|
240
240
|
fromDate: joi.string().required(),
|
|
241
241
|
toDate: joi.string().required(),
|
|
242
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
242
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
243
243
|
moduleType: joi.string().optional(),
|
|
244
244
|
},
|
|
245
245
|
);
|
|
@@ -252,7 +252,7 @@ export const overviewTableSchema = joi.object(
|
|
|
252
252
|
{
|
|
253
253
|
fromDate: joi.string().required(),
|
|
254
254
|
toDate: joi.string().required(),
|
|
255
|
-
clientId: joi.array().items( joi.string().required() ).required(),
|
|
255
|
+
clientId: joi.array().items( joi.string().required().allow( '' ) ).required(),
|
|
256
256
|
limit: joi.number().optional(),
|
|
257
257
|
offset: joi.number().optional(),
|
|
258
258
|
searchValue: joi.string().optional().allow( '' ),
|