tango-app-api-audit 3.4.3-alpha.2 → 3.4.3-alpha.3

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.4.3-alpha.2",
3
+ "version": "3.4.3-alpha.3",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4304,30 +4304,32 @@ export async function getUserAuditCountMTD( req, res ) {
4304
4304
 
4305
4305
  export async function auditViewLogs( req, res ) {
4306
4306
  try {
4307
- const parsedOpenSearch = JSON.parse( process.env.OPENSEARCH );
4308
- let downTimeQuery = {
4309
- 'size': 100,
4310
- 'query': {
4311
- 'bool': {
4312
- 'must': [
4313
- {
4314
- 'term': {
4315
- 'doc.date.keyword': dayjs( inputQuery.filedate ).format( 'DD-MM-YYYY' ),
4316
- },
4317
- },
4318
- {
4319
- 'term': {
4320
- 'doc.store_id.keyword': inputQuery.storeId,
4321
- },
4322
- },
4323
- ],
4307
+ // const inputData = req.query;
4308
+ // const parsedOpenSearch = JSON.parse( process.env.OPENSEARCH );
4309
+ // let downTimeQuery = {
4310
+ // 'size': 100,
4311
+ // 'query': {
4312
+ // 'bool': {
4313
+ // 'must': [
4314
+ // {
4315
+ // 'term': {
4316
+ // 'doc.date.keyword': dayjs( inputData.fileDate ).format( 'DD-MM-YYYY' ),
4317
+ // },
4318
+ // },
4319
+ // {
4320
+ // 'term': {
4321
+ // 'doc.store_id.keyword': inputData.storeId,
4322
+ // },
4323
+ // },
4324
+ // ],
4324
4325
 
4325
- },
4326
- },
4327
- };
4328
- const downtime = await getOpenSearchData( parsedOpenSearch.activityLog, downTimeQuery );
4329
- return res.sendSuccess( downtime );
4326
+ // },
4327
+ // },
4328
+ // };
4329
+ // const downtime = await getOpenSearchData( parsedOpenSearch.activityLog, downTimeQuery );
4330
+ // return res.sendSuccess( downtime );
4330
4331
  } catch ( err ) {
4331
4332
 
4332
4333
  }
4333
4334
  }
4335
+
@@ -16,7 +16,7 @@ import { findOneAuditLog, createAuditLog,
16
16
  import {
17
17
  findOneUserEmpDetection,
18
18
  } from '../service/userEmpDetection.service.js';
19
-
19
+ import { createempDetectionOutput } from '../service/auditUserWallet.service.js';
20
20
  // export async function getDetectionAuditFile( req, res ) {
21
21
  // try {
22
22
  // const bucket = JSON.parse( process.env.BUCKET );
@@ -4050,7 +4050,7 @@ export async function getDraftedData( req, res ) {
4050
4050
  export async function save( req, res ) {
4051
4051
  try {
4052
4052
  const inputData = req.body;
4053
- const data = await createEmpDetection( inputData );
4053
+ const data = await createempDetectionOutput( { storeId: inputData.storeId, moduleType: inputData.moduleType, fileDate: inputData.fileDate }, { $set: inputData }, { upsert: true } );
4054
4054
  if ( data ) {
4055
4055
  return res.sendSuccess( { result: 'Updated Successfully' } );
4056
4056
  } else {
@@ -45,7 +45,6 @@ export const saveDraftSchema = joi.object(
45
45
  storeId: joi.string().required(),
46
46
  auditId: joi.string().required(),
47
47
  moduleType: joi.string().required(),
48
- // zoneName: joi.string().required(),
49
48
  auditType: joi.string().required(),
50
49
  fileDate: joi.string().required(),
51
50
  queueName: joi.string().required(),
@@ -273,8 +272,6 @@ export const saveSchema = joi.object( {
273
272
  auditType: joi.string().required(),
274
273
  moduleType: joi.string().required(),
275
274
  beforeCount: joi.number().required(),
276
- junkCount: joi.number().required(),
277
- junk: joi.array().required(),
278
275
  employeeCount: joi.number().required(),
279
276
  employee: joi.array().required(),
280
277
  } );
@@ -41,5 +41,5 @@ auditRouter.get( '/get-user-audit-count', isAllowedSessionHandler, getUserAuditC
41
41
  auditRouter.get( '/get-user-audit-count-mtd', isAllowedSessionHandler, getUserAuditCountMTD );
42
42
 
43
43
  // audit log
44
- auditRouter.get( '/audit-viewLogs', auditViewLogs );
44
+ auditRouter.get( '/audit-view-logs', isAllowedSessionHandler, auditViewLogs );
45
45
  export default auditRouter;
@@ -1,5 +1,5 @@
1
1
  import auditUserWalletModel from 'tango-api-schema/schema/auditUserWallet.model.js';
2
-
2
+ import empDetectionOutputModel from 'tango-api-schema/schema/empDetectionOutput.model.js';
3
3
 
4
4
  export function createAuditUserWallet( record ) {
5
5
  return auditUserWalletModel.create( record );
@@ -8,3 +8,6 @@ export function createAuditUserWallet( record ) {
8
8
  export function updateManyAuditUserWallet( query, record ) {
9
9
  return auditUserWalletModel.updateMany( query, record, { upsert: true } );
10
10
  };
11
+ export function createempDetectionOutput( query, field, option ) {
12
+ return empDetectionOutputModel.updateOne( query, field, option );
13
+ };