tango-app-api-audit 3.6.44 → 3.6.45

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-audit",
3
- "version": "3.6.44",
3
+ "version": "3.6.45",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2355,15 +2355,9 @@ export async function summaryCard( req, res ) {
2355
2355
  const inputData = req.body;
2356
2356
  const openSearch = JSON.parse( process.env.OPENSEARCH );
2357
2357
 
2358
+
2358
2359
  let filter =[
2359
- {
2360
- 'range': {
2361
- 'date': {
2362
- 'gte': new Date( inputData.fromDate ),
2363
- 'lte': new Date( inputData.toDate ),
2364
- },
2365
- },
2366
- },
2360
+
2367
2361
  {
2368
2362
  term: {
2369
2363
  'type.keyword': inputData?.type,
@@ -2375,6 +2369,33 @@ export async function summaryCard( req, res ) {
2375
2369
  },
2376
2370
  },
2377
2371
  ];
2372
+
2373
+ if ( inputData?.dateType === 'auditedDate' ) {
2374
+ filter.push(
2375
+ {
2376
+ 'range': {
2377
+ 'updatedAt': {
2378
+ 'gte': new Date( inputData.fromDate ),
2379
+ 'lte': new Date( inputData.toDate ),
2380
+ },
2381
+ },
2382
+ },
2383
+
2384
+ );
2385
+ } else {
2386
+ filter.push(
2387
+ {
2388
+ 'range': {
2389
+ 'date': {
2390
+ 'gte': new Date( inputData.fromDate ),
2391
+ 'lte': new Date( inputData.toDate ),
2392
+ },
2393
+ },
2394
+ },
2395
+
2396
+ );
2397
+ }
2398
+
2378
2399
  if ( inputData?.demographics && inputData?.demographics?.length > 0 ) {
2379
2400
  filter.push( {
2380
2401
  terms: {
@@ -176,7 +176,7 @@ export const summaryListValid = {
176
176
 
177
177
 
178
178
  export const summaryCardSchema = joi.object( {
179
-
179
+ dateType: joi.string().optional().valid( 'fileDate', 'auditedDate' ),
180
180
  fromDate: joi.string()
181
181
  .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
182
182
  .required()