tango-app-api-audit 1.0.36 → 1.0.37

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": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,4 +1,4 @@
1
- import { getJsonFileData, getUTC, insertOpenSearchData, listFileByPath, sendMessageToQueue, signedUrl, sqsReceive } from 'tango-app-api-middleware';
1
+ import { download, getJsonFileData, getUTC, insertOpenSearchData, listFileByPath, sendMessageToQueue, signedUrl, sqsReceive } from 'tango-app-api-middleware';
2
2
  import { aggregateZoneUserAudit, createZoneUserAudit, findOneZoneUserAudit } from '../service/zoneUserAudit.service.js';
3
3
  import { logger } from 'tango-app-api-middleware';
4
4
  import { aggregateAssignZoneAudit } from '../service/assignZoneAudit.service.js';
@@ -10,6 +10,10 @@ import { aggregateUserAudit, findOneUserAudit, updateOneUserAudit } from '../ser
10
10
  import { aggregateAssignAudit } from '../service/assignAudit.service.js';
11
11
  import { createAuditLog, findOneAuditLog } from '../service/auditLog.service.js';
12
12
  import { mapCustomer, mapEmployee, mapJunk, splitB20000, splitE0, splitG20000 } from '../validation/audit.validation.js';
13
+ import { aggregateClient } from '../service/client.service.js';
14
+ import { aggregateAuditClientData } from '../service/auditClientData.service.js';
15
+ import _ from 'lodash';
16
+ import { listQueue } from 'tango-app-api-middleware/src/utils/aws/sqs.js';
13
17
 
14
18
  export async function getZoneAuditFile( req, res ) {
15
19
  try {
@@ -353,8 +357,8 @@ export async function getDraftedData( req, res ) {
353
357
  };
354
358
  const result = await findOneAuditLog( query, {}, { createdAt: -1 }, 1 );
355
359
 
356
- if ( result.length == 0 ) {
357
- return res.sendError( 'No Data Found', 500 );
360
+ if ( !result ) {
361
+ return res.sendError( 'No Data Found', 204 );
358
362
  }
359
363
  return res.sendSuccess( { result: result } );
360
364
  } catch ( error ) {
@@ -74,7 +74,13 @@ export const zoneAuditDocs = {
74
74
  in: 'query',
75
75
  name: 'storeId',
76
76
  scema: j2s( getDraftedDataSchema ).swagger,
77
- require: false,
77
+ require: true,
78
+ },
79
+ {
80
+ in: 'query',
81
+ name: 'zoneName',
82
+ scema: j2s( getDraftedDataSchema ).swagger,
83
+ require: true,
78
84
  },
79
85
  ],
80
86
  responses: {