tango-app-api-audit 3.5.24 → 3.5.26
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
|
@@ -7,7 +7,7 @@ import timezone from 'dayjs/plugin/timezone.js';
|
|
|
7
7
|
import 'dayjs/locale/en.js';
|
|
8
8
|
import { findOneEyeTestConfig, updateOneEyeTestConfig } from '../service/eyeTestConfiguration.service.js';
|
|
9
9
|
import { ObjectId } from 'mongodb';
|
|
10
|
-
import { aggregateClusters } from '../service/clusters.service.js';
|
|
10
|
+
import { aggregateClusters, findOneClusters } from '../service/clusters.service.js';
|
|
11
11
|
|
|
12
12
|
dayjs.extend( utc );
|
|
13
13
|
dayjs.extend( timezone );
|
|
@@ -1081,6 +1081,56 @@ export async function userAuditedData( req, res ) {
|
|
|
1081
1081
|
export async function summaryList( req, res ) {
|
|
1082
1082
|
try {
|
|
1083
1083
|
const inputData = req.body;
|
|
1084
|
+
if ( inputData.clientId !== '11' ) {
|
|
1085
|
+
return res.sendError( 'No data found', 204 );
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
1089
|
+
const limit = inputData.limit || 10;
|
|
1090
|
+
const offset = inputData.offset ? ( inputData.offset - 1 ) * limit : 0;
|
|
1091
|
+
|
|
1092
|
+
const sortBy = inputData?.sortBy ? [ 'coveredStepsAI', 'trustScore', 'date' ].includes( inputData.sortBy ) ? inputData.sortBy :`${inputData.sortBy}.keyword` : 'storeName.keyword';
|
|
1093
|
+
const order = inputData?.sortOrder || -1;
|
|
1094
|
+
|
|
1095
|
+
let filter= [
|
|
1096
|
+
{
|
|
1097
|
+
'range': {
|
|
1098
|
+
'date': {
|
|
1099
|
+
'gte': new Date( inputData.fromDate ),
|
|
1100
|
+
'lte': new Date( inputData.toDate ),
|
|
1101
|
+
},
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
|
|
1105
|
+
];
|
|
1106
|
+
if ( inputData.demographics && inputData.demographics.length > 0 ) {
|
|
1107
|
+
filter.push( {
|
|
1108
|
+
'terms': {
|
|
1109
|
+
'visitorsType.keyword': inputData.demographics,
|
|
1110
|
+
},
|
|
1111
|
+
} );
|
|
1112
|
+
}
|
|
1113
|
+
if ( inputData.type && inputData.type!='' ) {
|
|
1114
|
+
filter.push( {
|
|
1115
|
+
'term': {
|
|
1116
|
+
'type.keyword': inputData.type,
|
|
1117
|
+
},
|
|
1118
|
+
|
|
1119
|
+
} );
|
|
1120
|
+
}
|
|
1121
|
+
if ( inputData.storeId && inputData.storeId.length > 0 ) {
|
|
1122
|
+
filter.push( {
|
|
1123
|
+
|
|
1124
|
+
'terms': {
|
|
1125
|
+
'storeId.keyword': inputData.storeId,
|
|
1126
|
+
},
|
|
1127
|
+
|
|
1128
|
+
} );
|
|
1129
|
+
} else {
|
|
1130
|
+
return res.sendError( 'No data found', 204 );
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
|
|
1084
1134
|
if ( inputData.keyType === 'rm' ) {
|
|
1085
1135
|
return res.sendSuccess( { result: [
|
|
1086
1136
|
{
|
|
@@ -1108,211 +1158,245 @@ export async function summaryList( req, res ) {
|
|
|
1108
1158
|
|
|
1109
1159
|
], count: 1 } );
|
|
1110
1160
|
} else {
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1161
|
+
let search ={
|
|
1162
|
+
'must': filter,
|
|
1163
|
+
};
|
|
1164
|
+
if ( inputData.searchValue && inputData.searchValue !== '' ) {
|
|
1165
|
+
if ( inputData.type&&inputData.type==='remote' ) {
|
|
1166
|
+
search ={
|
|
1167
|
+
'must': filter,
|
|
1168
|
+
'should': [
|
|
1169
|
+
{
|
|
1170
|
+
'wildcard': {
|
|
1171
|
+
'storeName.keyword': {
|
|
1172
|
+
'value': `*${inputData.searchValue}*`,
|
|
1173
|
+
},
|
|
1174
|
+
},
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
'wildcard': {
|
|
1178
|
+
'storeId.keyword': {
|
|
1179
|
+
'value': `*${inputData.searchValue}*`,
|
|
1180
|
+
},
|
|
1181
|
+
},
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
'wildcard': {
|
|
1185
|
+
'engagementId.keyword': {
|
|
1186
|
+
'value': `*${inputData.searchValue}*`,
|
|
1187
|
+
},
|
|
1188
|
+
},
|
|
1189
|
+
},
|
|
1190
|
+
|
|
1191
|
+
{
|
|
1192
|
+
'wildcard': {
|
|
1193
|
+
'auditStatus.keyword': {
|
|
1194
|
+
'value': `*${inputData.searchValue}*`,
|
|
1195
|
+
},
|
|
1196
|
+
},
|
|
1197
|
+
},
|
|
1198
|
+
],
|
|
1199
|
+
'minimum_should_match': 1,
|
|
1200
|
+
};
|
|
1201
|
+
} else {
|
|
1202
|
+
search ={
|
|
1203
|
+
'must': filter,
|
|
1204
|
+
'should': [
|
|
1205
|
+
{
|
|
1206
|
+
'wildcard': {
|
|
1207
|
+
'storeName.keyword': {
|
|
1208
|
+
'value': `*${inputData.searchValue}*`,
|
|
1209
|
+
},
|
|
1210
|
+
},
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
'wildcard': {
|
|
1214
|
+
'storeId.keyword': {
|
|
1215
|
+
'value': `*${inputData.searchValue}*`,
|
|
1216
|
+
},
|
|
1217
|
+
},
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
'wildcard': {
|
|
1221
|
+
'engagementId.keyword': {
|
|
1222
|
+
'value': `*${inputData.searchValue}*`,
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1225
|
+
},
|
|
1226
|
+
{
|
|
1227
|
+
'wildcard': {
|
|
1228
|
+
'queueId.keyword': {
|
|
1229
|
+
'value': `*${inputData.searchValue}*`,
|
|
1230
|
+
},
|
|
1231
|
+
},
|
|
1232
|
+
},
|
|
1233
|
+
{
|
|
1234
|
+
'wildcard': {
|
|
1235
|
+
'optumId.keyword': {
|
|
1236
|
+
'value': `*${inputData.searchValue}*`,
|
|
1237
|
+
},
|
|
1238
|
+
},
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
'wildcard': {
|
|
1242
|
+
'visitorsType.keyword': {
|
|
1243
|
+
'value': `*${inputData.searchValue}*`,
|
|
1244
|
+
},
|
|
1245
|
+
},
|
|
1246
|
+
},
|
|
1247
|
+
|
|
1248
|
+
{
|
|
1249
|
+
'wildcard': {
|
|
1250
|
+
'auditStatus.keyword': {
|
|
1251
|
+
'value': `*${inputData.searchValue}*`,
|
|
1252
|
+
},
|
|
1253
|
+
},
|
|
1254
|
+
},
|
|
1255
|
+
],
|
|
1256
|
+
'minimum_should_match': 1,
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
let searchQuery={
|
|
1262
|
+
'from': offset,
|
|
1263
|
+
'size': limit,
|
|
1264
|
+
'query': {
|
|
1265
|
+
'bool': search,
|
|
1170
1266
|
},
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
'
|
|
1179
|
-
'
|
|
1180
|
-
'
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
'
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
'userId': null,
|
|
1187
|
-
'visitorsType': 'adult',
|
|
1188
|
-
'inputBucketName': 'tango-eye-test-output',
|
|
1189
|
-
'filePath': 'eye-test/2025-08-18/11-10/106772967_164980.mp4',
|
|
1190
|
-
'startTime': '',
|
|
1191
|
-
'endTime': '',
|
|
1192
|
-
'displayName': '',
|
|
1193
|
-
'testStartTime': '12:25:32',
|
|
1194
|
-
'testEndTime': '12:35:12',
|
|
1195
|
-
'createdAt': '2025-08-19T11:56:55.822Z',
|
|
1196
|
-
'updatedAt': '2025-08-19T11:56:55.822Z',
|
|
1197
|
-
'steps': [
|
|
1198
|
-
{
|
|
1199
|
-
'processName': 'Distance-VA-Check',
|
|
1200
|
-
'AIStatus': true,
|
|
1201
|
-
'predictedTranscript': '',
|
|
1202
|
-
},
|
|
1203
|
-
{
|
|
1204
|
-
'processName': 'DuoChrome-Test',
|
|
1205
|
-
'AIStatus': true,
|
|
1206
|
-
'predictedTranscript': '',
|
|
1207
|
-
},
|
|
1208
|
-
{
|
|
1209
|
-
'processName': 'Prescription-Verification',
|
|
1210
|
-
'AIStatus': true,
|
|
1211
|
-
'predictedTranscript': '',
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
'processName': 'Near-VA-Check',
|
|
1215
|
-
'AIStatus': true,
|
|
1216
|
-
'predictedTranscript': '',
|
|
1217
|
-
},
|
|
1218
|
-
{
|
|
1219
|
-
'processName': 'Torchlight',
|
|
1220
|
-
'AIStatus': false,
|
|
1221
|
-
'predictedTranscript': '',
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
'processName': 'JCC',
|
|
1225
|
-
'AIStatus': false,
|
|
1226
|
-
'predictedTranscript': '',
|
|
1227
|
-
},
|
|
1267
|
+
'sort': [
|
|
1268
|
+
{ date: { order: 'desc' } },
|
|
1269
|
+
],
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
if ( sortBy && sortBy !== '' ) {
|
|
1273
|
+
searchQuery={
|
|
1274
|
+
'from': offset,
|
|
1275
|
+
'size': limit,
|
|
1276
|
+
'query': {
|
|
1277
|
+
'bool': search,
|
|
1278
|
+
},
|
|
1279
|
+
'sort': [
|
|
1280
|
+
{ [sortBy]: { order: order === -1 ?'desc':'asc' } },
|
|
1281
|
+
{ '_id': 'asc' },
|
|
1228
1282
|
],
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
if ( inputData.isExport==true ) {
|
|
1287
|
+
searchQuery={
|
|
1288
|
+
'from': 0,
|
|
1289
|
+
'size': 10000,
|
|
1290
|
+
'query': {
|
|
1291
|
+
'bool': search,
|
|
1292
|
+
},
|
|
1293
|
+
'sort': [
|
|
1294
|
+
{ 'storeName.keyword': { order: 'desc' } },
|
|
1295
|
+
],
|
|
1296
|
+
};
|
|
1297
|
+
// allResult =await fetchAllDocuments( openSearch.EyeTestInput, search );
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
const countQuery = {
|
|
1301
|
+
query: {
|
|
1302
|
+
bool: search,
|
|
1229
1303
|
},
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
'
|
|
1300
|
-
'
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
'
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
const result = await getOpenSearchData( openSearch.EyeTestInput, searchQuery );
|
|
1307
|
+
const getCount = inputData.isExport==true? null:await getOpenSearchCount( openSearch.EyeTestInput, countQuery );
|
|
1308
|
+
const count =inputData.isExport==true?null: getCount?.body?.count;
|
|
1309
|
+
const searchValue = result?.body?.hits?.hits;
|
|
1310
|
+
const temp =[];
|
|
1311
|
+
if ( !searchValue || searchValue?.length == 0 ) {
|
|
1312
|
+
return res.sendError( 'No data found', 204 );
|
|
1313
|
+
}
|
|
1314
|
+
if ( inputData.isExport == true ) {
|
|
1315
|
+
const chunkedMappingData = await chunkArray( searchValue, 10 );
|
|
1316
|
+
const promises = chunkedMappingData.map( async ( chunk ) => {
|
|
1317
|
+
const exportData = [];
|
|
1318
|
+
for ( const element of chunk ) {
|
|
1319
|
+
const testDuration = element?._source?.testDuration;
|
|
1320
|
+
const minutes = Math.floor( testDuration / 60 );
|
|
1321
|
+
const seconds = testDuration % 60;
|
|
1322
|
+
const minutes1 =minutes> 1? `${minutes} mins` : `${minutes} min`;
|
|
1323
|
+
const seconds1 = seconds > 1? `${minutes} secs`: seconds == 1? `${minutes} sec` : '';
|
|
1324
|
+
const duration =`${minutes1} ${seconds1}`;
|
|
1325
|
+
let userName = '';
|
|
1326
|
+
if ( element?._source?.userId&&element?._source?.userId!='' ) {
|
|
1327
|
+
userName = await findOneUser( { _id: element?._source?.userId }, { _id: 0, userName: 1 } );
|
|
1328
|
+
}
|
|
1329
|
+
if ( element?._source?.type == 'physical' ) {
|
|
1330
|
+
exportData.push( {
|
|
1331
|
+
'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
|
|
1332
|
+
'Store Name': element?._source?.storeName,
|
|
1333
|
+
'Store ID': element?._source?.storeId || 'Un Assigned',
|
|
1334
|
+
'Store Name': element?._source?.storeName ||'Un Assigned',
|
|
1335
|
+
'Optum ID': element?._source?.optumId,
|
|
1336
|
+
'Queue ID': element?._source?.queueId,
|
|
1337
|
+
'Compliance Score': element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 ): 0,
|
|
1338
|
+
'Steps Covered By AI': element?._source?.coveredStepsAI || 0,
|
|
1339
|
+
'Trust Score': element?._source?.trustScore || 0,
|
|
1340
|
+
'Visitor Type': element?._source?.visitorsType,
|
|
1341
|
+
'Test Duration': duration || '',
|
|
1342
|
+
'Audit Status': element?._source?.auditStatus || '',
|
|
1343
|
+
'Audited By': userName?.userName || '',
|
|
1344
|
+
|
|
1345
|
+
} );
|
|
1346
|
+
} else {
|
|
1347
|
+
exportData.push( {
|
|
1348
|
+
'Date': dayjs( element?._source?.date ).format( 'D MMM, YYYY' ),
|
|
1349
|
+
'Store Name': element?._source?.storeName,
|
|
1350
|
+
'Store ID': element?._source?.storeId || 'Un Assigned',
|
|
1351
|
+
'Store Name': element?._source?.storeName ||'Un Assigned',
|
|
1352
|
+
'Engagement ID': element?._source?.engagementId,
|
|
1353
|
+
'Compliance Score': element?._source?.totalSteps>0 ? Math.round( ( element?._source?.coveredStepsAI/ element?._source?.totalSteps )*100 ): 0,
|
|
1354
|
+
'Steps Covered By AI': element?._source?.coveredStepsAI || 0,
|
|
1355
|
+
'Trust Score': element?._source?.trustScore ||0,
|
|
1356
|
+
'Test Duration': duration || '',
|
|
1357
|
+
'Audit Status': element?._source?.auditStatus || '',
|
|
1358
|
+
'Audited By': userName?.userName || '',
|
|
1359
|
+
|
|
1360
|
+
} );
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
return exportData;
|
|
1364
|
+
} );
|
|
1365
|
+
const mappedArrays = await Promise.all( promises );
|
|
1366
|
+
const result = mappedArrays.flat();
|
|
1367
|
+
await download( result, res );
|
|
1368
|
+
return;
|
|
1369
|
+
} else {
|
|
1370
|
+
for ( const [ i, item ] of searchValue.entries() ) {
|
|
1371
|
+
temp.push( item?._source );
|
|
1372
|
+
logger.info( { source: item } );
|
|
1373
|
+
let userName='';
|
|
1374
|
+
if ( item?._source?.userId&&item?._source?.userId!='' ) {
|
|
1375
|
+
userName = await findOneUser( { _id: item?._source?.userId }, { _id: 0, userName: 1 } );
|
|
1376
|
+
}
|
|
1377
|
+
let RMName = '';
|
|
1378
|
+
let clusterName='';
|
|
1379
|
+
if ( item?._source?.storeId&&item?._source?.storeId!='' ) {
|
|
1380
|
+
const getCluster = await findOneClusters( { 'stores.storeId': item?._source?.storeId }, { Teamlead: 1, clusterName: 1 } );
|
|
1381
|
+
RMName =( getCluster && getCluster.Teamlead?.length > 0 )? getCluster?.Teamlead?.[0]?.email : '';
|
|
1382
|
+
clusterName = getCluster?.clusterName;
|
|
1383
|
+
}
|
|
1384
|
+
logger.info( { RMName: RMName } );
|
|
1385
|
+
const testDuration = item?._source?.testDuration;
|
|
1386
|
+
const minutes = Math.floor( testDuration / 60 );
|
|
1387
|
+
const seconds = testDuration % 60;
|
|
1388
|
+
temp[i].complianceScore = item?._source?.totalSteps>0 ? Math.round( ( item?._source?.coveredStepsAI/ item?._source?.totalSteps )*100 ): 0;
|
|
1389
|
+
temp[i].min = minutes;
|
|
1390
|
+
temp[i].sec = seconds;
|
|
1391
|
+
temp[i].auditedBy = userName?.userName || '';
|
|
1392
|
+
temp[i].date = dayjs( item?._source?.date ).format( 'D MMM, YYYY' );
|
|
1393
|
+
temp[i].RMName = RMName;
|
|
1394
|
+
temp[i].clusterName =clusterName;
|
|
1395
|
+
}
|
|
1396
|
+
logger.info( { temp: temp } );
|
|
1397
|
+
}
|
|
1314
1398
|
|
|
1315
|
-
|
|
1399
|
+
return res.sendSuccess( { result: temp, count: count } );
|
|
1316
1400
|
}
|
|
1317
1401
|
} catch ( error ) {
|
|
1318
1402
|
const err = error.message || 'Internal Server Error';
|
|
@@ -146,6 +146,14 @@ export const summaryListSchema = joi.object( {
|
|
|
146
146
|
'any.required': 'Type is required',
|
|
147
147
|
'string.empty': 'Type cannot be empty',
|
|
148
148
|
} ),
|
|
149
|
+
clientId: joi.string().when( '$userType', {
|
|
150
|
+
is: 'tango',
|
|
151
|
+
then: joi.required().messages( {
|
|
152
|
+
'any.required': 'clientId is required',
|
|
153
|
+
'string.base': 'clientId must be a string',
|
|
154
|
+
} ),
|
|
155
|
+
otherwise: joi.optional(),
|
|
156
|
+
} ),
|
|
149
157
|
demographics: joi.array().optional(),
|
|
150
158
|
RMList: joi.array().items(
|
|
151
159
|
joi.string().required(),
|
|
@@ -158,6 +166,8 @@ export const summaryListSchema = joi.object( {
|
|
|
158
166
|
sortBy: joi.string().optional(),
|
|
159
167
|
sortOrder: joi.number().optional(),
|
|
160
168
|
category: joi.string().optional() .valid( 'fake', 'genuine' ),
|
|
169
|
+
offset: joi.number().optional(),
|
|
170
|
+
limit: joi.number().optional(),
|
|
161
171
|
} );
|
|
162
172
|
|
|
163
173
|
export const summaryListValid = {
|
|
@@ -206,6 +216,14 @@ export const summaryCardSchema = joi.object( {
|
|
|
206
216
|
'any.required': 'Type is required',
|
|
207
217
|
'string.empty': 'Type cannot be empty',
|
|
208
218
|
} ),
|
|
219
|
+
clientId: joi.string().when( '$userType', {
|
|
220
|
+
is: 'tango',
|
|
221
|
+
then: joi.required().messages( {
|
|
222
|
+
'any.required': 'clientId is required',
|
|
223
|
+
'string.base': 'clientId must be a string',
|
|
224
|
+
} ),
|
|
225
|
+
otherwise: joi.optional(),
|
|
226
|
+
} ),
|
|
209
227
|
demographics: joi.array().optional(),
|
|
210
228
|
RMList: joi.array().items(
|
|
211
229
|
joi.string().optional(),
|