tango-app-api-audit 3.4.2 → 3.4.3-alpha.1

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.
@@ -528,7 +528,35 @@ export const auditDocs = {
528
528
  get: {
529
529
  tags: [ 'Audit Mapping' ],
530
530
  description: 'Get total Not Assigned Count',
531
- operationId: 'clients',
531
+ operationId: 'total-not-assigned-count',
532
+ responses: {
533
+ 200: { description: 'Successful' },
534
+ 401: { description: 'Unauthorized User' },
535
+ 422: { description: 'Field Error' },
536
+ 500: { description: 'Server Error' },
537
+ 204: { description: 'Not Found' },
538
+ },
539
+ },
540
+ },
541
+ '/v3/audit/get-user-audit-count': {
542
+ get: {
543
+ tags: [ 'Audit User Wallet' ],
544
+ description: 'Get total Not Assigned Count',
545
+ operationId: 'get-user-audit-count',
546
+ responses: {
547
+ 200: { description: 'Successful' },
548
+ 401: { description: 'Unauthorized User' },
549
+ 422: { description: 'Field Error' },
550
+ 500: { description: 'Server Error' },
551
+ 204: { description: 'Not Found' },
552
+ },
553
+ },
554
+ },
555
+ '/v3/audit/get-user-audit-count-mtd': {
556
+ get: {
557
+ tags: [ 'Audit User Wallet' ],
558
+ description: 'Get total Not Assigned Count',
559
+ operationId: 'get-user-audit-count-mtd',
532
560
  responses: {
533
561
  200: { description: 'Successful' },
534
562
  401: { description: 'Unauthorized User' },
@@ -1,5 +1,5 @@
1
1
  import j2s from 'joi-to-swagger';
2
- import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema, getUpdatedFileSchema } from '../dtos/traxAudit.dtos.js';
2
+ import { getFileSchema, userAuditHistorySchema, workSpaceSchema, saveSchema, clientMetricsSchema, storeMetricsSchema, userMetricsSchema, pendingSummaryTableSchema, overAllAuditSummarySchema, overviewTableSchema, summarySplitSchema, getUpdatedFileSchema, getDetectionFileValid, saveBinarySchema, saveDraftSchema, getDraftedDataSchema } from '../dtos/traxAudit.dtos.js';
3
3
 
4
4
  export const traxAuditDocs = {
5
5
 
@@ -15,18 +15,6 @@ export const traxAuditDocs = {
15
15
  scema: j2s( getFileSchema ).swagger,
16
16
  require: true,
17
17
  },
18
- // {
19
- // in: 'query',
20
- // name: 'nextId',
21
- // scema: j2s( getFileSchema ).swagger,
22
- // require: false,
23
- // },
24
- // {
25
- // in: 'query',
26
- // name: 'limit',
27
- // scema: j2s( getFileSchema ).swagger,
28
- // require: false,
29
- // },
30
18
  {
31
19
  in: 'query',
32
20
  name: 'moduleType',
@@ -43,6 +31,46 @@ export const traxAuditDocs = {
43
31
  },
44
32
  },
45
33
  },
34
+ '/v3/trax-audit/get-file-detection': {
35
+ get: {
36
+ tags: [ 'Trax Audit' ],
37
+ description: 'Get a file via queue message',
38
+ operationId: 'get-file-detection',
39
+ parameters: [
40
+ {
41
+ in: 'query',
42
+ name: 'queueName',
43
+ scema: j2s( getDetectionFileValid ).swagger,
44
+ require: true,
45
+ },
46
+ {
47
+ in: 'query',
48
+ name: 'nextId',
49
+ scema: j2s( getDetectionFileValid ).swagger,
50
+ require: false,
51
+ },
52
+ {
53
+ in: 'query',
54
+ name: 'limit',
55
+ scema: j2s( getDetectionFileValid ).swagger,
56
+ require: false,
57
+ },
58
+ {
59
+ in: 'query',
60
+ name: 'moduleType',
61
+ scema: j2s( getDetectionFileValid ).swagger,
62
+ require: true,
63
+ },
64
+ ],
65
+ responses: {
66
+ 200: { description: 'Successful' },
67
+ 401: { description: 'Unauthorized User' },
68
+ 422: { description: 'Field Error' },
69
+ 500: { description: 'Server Error' },
70
+ 204: { description: 'Not Found' },
71
+ },
72
+ },
73
+ },
46
74
  '/v3/trax-audit/get-updated-file': {
47
75
  post: {
48
76
  tags: [ 'Trax Audit' ],
@@ -96,7 +124,7 @@ export const traxAuditDocs = {
96
124
  requestBody: {
97
125
  content: {
98
126
  'application/json': {
99
- schema: j2s( saveSchema ).swagger,
127
+ schema: j2s( saveBinarySchema ).swagger,
100
128
  },
101
129
  },
102
130
  },
@@ -289,4 +317,90 @@ export const traxAuditDocs = {
289
317
  },
290
318
  },
291
319
  },
320
+ '/v3/trax-audit/save': {
321
+ post: {
322
+ tags: [ 'Trax Audit' ],
323
+ description: `submit the audit file. which is store in the bucket in the json format`,
324
+ operationId: 'save',
325
+ parameters: {},
326
+ requestBody: {
327
+ content: {
328
+ 'application/json': {
329
+ schema: j2s( saveSchema ).swagger,
330
+ },
331
+ },
332
+ },
333
+ responses: {
334
+ 200: { description: 'The Audited file has been submited successfully ' },
335
+ 401: { description: 'Unauthorized User' },
336
+ 422: { description: 'Field Error' },
337
+ 500: { description: 'Server Error' },
338
+ 204: { description: 'Not Found' },
339
+ },
340
+ },
341
+ },
342
+
343
+ '/v3/trax-audit/save-draft': {
344
+ post: {
345
+ tags: [ 'Trax Audit' ],
346
+ description: `save audited file. which is save in the mongo db`,
347
+ operationId: 'save-draft',
348
+ parameters: {},
349
+ requestBody: {
350
+ content: {
351
+ 'application/json': {
352
+ schema: j2s( saveDraftSchema ).swagger,
353
+ },
354
+ },
355
+ },
356
+ responses: {
357
+ 200: { description: 'Successful' },
358
+ 401: { description: 'Unauthorized User' },
359
+ 422: { description: 'Field Error' },
360
+ 500: { description: 'Server Error' },
361
+ 204: { description: 'Not Found' },
362
+ },
363
+ },
364
+ },
365
+
366
+ '/v3/reax-audit/get-drafted-data': {
367
+ get: {
368
+ tags: [ 'Trax Audit' ],
369
+ description: 'Get a saved file via DB',
370
+ operationId: 'get-drafted-data',
371
+ parameters: [
372
+ {
373
+ in: 'query',
374
+ name: 'fileDate',
375
+ scema: j2s( getDraftedDataSchema ).swagger,
376
+ require: true,
377
+ },
378
+ {
379
+ in: 'query',
380
+ name: 'storeId',
381
+ scema: j2s( getDraftedDataSchema ).swagger,
382
+ require: true,
383
+ },
384
+ {
385
+ in: 'query',
386
+ name: 'moduleType',
387
+ scema: j2s( getDraftedDataSchema ).swagger,
388
+ require: true,
389
+ },
390
+ {
391
+ in: 'query',
392
+ name: 'userId',
393
+ scema: j2s( getDraftedDataSchema ).swagger,
394
+ require: false,
395
+ },
396
+ ],
397
+ responses: {
398
+ 200: { description: 'Successful' },
399
+ 401: { description: 'Unauthorized User' },
400
+ 422: { description: 'Field Error' },
401
+ 500: { description: 'Server Error' },
402
+ 204: { description: 'Not Found' },
403
+ },
404
+ },
405
+ },
292
406
  };
@@ -96,8 +96,6 @@ export const saveSchema = joi.object( {
96
96
  employee: joi.array().required(),
97
97
  customerCount: joi.number().required(),
98
98
  customer: joi.array().required(),
99
- moduleType: joi.string().required(),
100
- zoneName: joi.string().required(),
101
99
  } );
102
100
 
103
101
  export const saveValid = {
@@ -54,8 +54,6 @@ export const saveDraftSchema = joi.object(
54
54
  junk: joi.array().optional(),
55
55
  employeeCount: joi.number().optional(),
56
56
  employee: joi.array().optional(),
57
- customerCount: joi.number().optional(),
58
- customer: joi.array().optional(),
59
57
  retagCount: joi.number().optional(),
60
58
  retagImage: joi.array().optional(),
61
59
  },
@@ -71,7 +69,6 @@ export const getDraftedDataSchema = joi.object(
71
69
  fileDate: joi.string().required(),
72
70
  userId: joi.string().optional(),
73
71
  moduleType: joi.string().required(),
74
- zoneName: joi.string().required(),
75
72
  },
76
73
  );
77
74
 
@@ -79,7 +76,7 @@ export const getDraftedDataValid = {
79
76
  query: getDraftedDataSchema,
80
77
  };
81
78
 
82
- export const saveSchema = joi.object(
79
+ export const saveBinarySchema = joi.object(
83
80
  {
84
81
  auditId: joi.string().required(),
85
82
  storeId: joi.string().required(),
@@ -93,8 +90,8 @@ export const saveSchema = joi.object(
93
90
  },
94
91
  );
95
92
 
96
- export const saveValid = {
97
- body: saveSchema,
93
+ export const saveBinaryValid = {
94
+ body: saveBinarySchema,
98
95
  };
99
96
 
100
97
  export const workSpaceSchema = joi.object(
@@ -268,3 +265,20 @@ export const overviewTableSchema = joi.object(
268
265
  export const overviewTableValid= {
269
266
  body: overviewTableSchema,
270
267
  };
268
+
269
+ export const saveSchema = joi.object( {
270
+ auditId: joi.string().required(),
271
+ storeId: joi.string().required(),
272
+ fileDate: joi.string().required(),
273
+ auditType: joi.string().required(),
274
+ moduleType: joi.string().required(),
275
+ beforeCount: joi.number().required(),
276
+ junkCount: joi.number().required(),
277
+ junk: joi.array().required(),
278
+ employeeCount: joi.number().required(),
279
+ employee: joi.array().required(),
280
+ } );
281
+
282
+ export const saveValid = {
283
+ body: saveSchema,
284
+ };
@@ -1,7 +1,7 @@
1
1
  import express from 'express';
2
2
  import { isAuditDocumentExist, isAuditInputFolderExist, isExistsQueue, validateUserAudit } from '../validation/audit.validation.js';
3
3
  import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
4
- import { auditImages, auditStoreList, auditUserList, clientMetrics, clients, getAuditFile, getDraftedData, overAllAuditSummary, overViewCard, overviewTable, pendingSummaryTable, reTrigger, save, saveDraft, storeMetrics, summarySplit, totalNotAssignedCount, userAuditHistory, userMetrics, workSpace } from '../controllers/audit.controllers.js';
4
+ import { auditImages, auditStoreList, auditUserList, clientMetrics, clients, getAuditFile, getDraftedData, overAllAuditSummary, overViewCard, overviewTable, pendingSummaryTable, reTrigger, save, saveDraft, storeMetrics, summarySplit, totalNotAssignedCount, userAuditHistory, userMetrics, workSpace, getUserAuditCount, getUserAuditCountMTD } from '../controllers/audit.controllers.js';
5
5
  import { auditStoreValid, clientMetricsValid, clientValid, getDraftedDataValid, getFileValid, overAllAuditSummaryValid, overViewCardValid, pendingSummaryTableValid, reTriggerValid, saveDraftValid, saveValid, storeMetricsValid, summarySplitValid, userAuditHistoryValid, userMetricsValid, workSpaceValid, auditImageValid, overviewTableValid } from '../dtos/audit.dtos.js';
6
6
 
7
7
  export const auditRouter = express.Router();
@@ -35,4 +35,8 @@ auditRouter.post( '/metrics/overview-table', isAllowedSessionHandler, validate(
35
35
 
36
36
  // ticket
37
37
  auditRouter.get( '/total-not-assigned-count', isAllowedSessionHandler, totalNotAssignedCount );
38
+
39
+ // audit user wallet
40
+ auditRouter.get( '/get-user-audit-count', isAllowedSessionHandler, getUserAuditCount );
41
+ auditRouter.get( '/get-user-audit-count-mtd', isAllowedSessionHandler, getUserAuditCountMTD );
38
42
  export default auditRouter;
@@ -1,27 +1,28 @@
1
1
  import { Router } from 'express';
2
2
  import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
3
- import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid, getUpdatedFileValid } from '../dtos/traxAudit.dtos.js';
3
+ import { getDetectionFileValid, getFileValid, userAuditHistoryValid, workSpaceValid, saveValid, clientMetricsValid, storeMetricsValid, userMetricsValid, pendingSummaryTableValid, overAllAuditSummaryValid, summarySplitValid, overviewTableValid, getUpdatedFileValid, saveBinaryValid, getDraftedDataValid } from '../dtos/traxAudit.dtos.js';
4
4
  import { isExistsQueue } from '../validation/audit.validation.js';
5
- import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace } from '../controllers/traxAudit.controllers.js';
5
+ import { clientMetrics, getAuditFile, getDetectionAuditFile, getUpdatedFile, overAllAuditSummary, overviewTable, pendingSummaryTable, saveBinary, storeMetrics, summarySplit, userAuditHistory, userMetrics, workSpace, saveDraft, getDraftedData, save } from '../controllers/traxAudit.controllers.js';
6
6
  import { isTraxAuditDocumentExist, validateBinaryAudit } from '../validation/traxAuditValidation.js';
7
+ import { saveDraftValid } from '../dtos/audit.dtos.js';
7
8
 
8
9
  export const traxAuditRouter = Router();
9
10
 
10
11
  // Audit Mapping
11
12
 
12
13
  traxAuditRouter.get( '/get-file-detection', isAllowedSessionHandler, validate( getDetectionFileValid ), isExistsQueue, getDetectionAuditFile );
13
- // traxAuditRouter.post( '/save-draft', isAllowedSessionHandler, validate( saveDraftValid ), saveDraft );
14
- // traxAuditRouter.get( '/get-drafted-data', isAllowedSessionHandler, validate( getDraftedDataValid ), getDraftedData );
15
- // traxAuditRouter.post( '/save', isAllowedSessionHandler, validate( saveValid ), validateUserEmpDetection, save ); use this validateuserEMpDetection
16
- traxAuditRouter.post( '/work-space', isAllowedSessionHandler, validate( workSpaceValid ), workSpace );
14
+ traxAuditRouter.post( '/save', validate( saveValid ), isAllowedSessionHandler, save );
15
+ traxAuditRouter.post( '/save-draft', validate( saveDraftValid ), isAllowedSessionHandler, saveDraft );
16
+ traxAuditRouter.get( '/get-drafted-data', validate( getDraftedDataValid ), isAllowedSessionHandler, getDraftedData );
17
17
 
18
18
 
19
19
  // Y/n
20
20
  traxAuditRouter.get( '/get-file', isAllowedSessionHandler, validate( getFileValid ), isExistsQueue, getAuditFile );
21
21
  traxAuditRouter.post( '/get-updated-file', isAllowedSessionHandler, validate( getUpdatedFileValid ), isTraxAuditDocumentExist, getUpdatedFile );
22
- traxAuditRouter.post( '/save-binary-audit', isAllowedSessionHandler, validate( saveValid ), validateBinaryAudit, saveBinary );
22
+ traxAuditRouter.post( '/save-binary-audit', isAllowedSessionHandler, validate( saveBinaryValid ), validateBinaryAudit, saveBinary );
23
23
 
24
24
  // metrcis
25
+ traxAuditRouter.post( '/work-space', isAllowedSessionHandler, validate( workSpaceValid ), workSpace );
25
26
  traxAuditRouter.post( '/metrics/user-audit-history', isAllowedSessionHandler, validate( userAuditHistoryValid ), userAuditHistory );
26
27
  traxAuditRouter.post( '/metrics/client-metrics', isAllowedSessionHandler, validate( clientMetricsValid ), clientMetrics );
27
28
  traxAuditRouter.post( '/metrics/store-metrics', isAllowedSessionHandler, validate( storeMetricsValid ), storeMetrics );
@@ -8,3 +8,11 @@ export function aggregateAuditStoreData( query ) {
8
8
  export function findOneStoreData( query, fields, sort ) {
9
9
  return auditStoreDataModel.findOne( query, fields ).sort( sort );
10
10
  }
11
+
12
+ export function findAuditStoreData( query ) {
13
+ return auditStoreDataModel.find( query );
14
+ }
15
+
16
+ export function countDocumentsAuditStoreDate( query ) {
17
+ return auditStoreDataModel.countDocuments( query );
18
+ }
@@ -0,0 +1,10 @@
1
+ import auditUserWalletModel from 'tango-api-schema/schema/auditUserWallet.model.js';
2
+
3
+
4
+ export function createAuditUserWallet( record ) {
5
+ return auditUserWalletModel.create( record );
6
+ };
7
+
8
+ export function updateManyAuditUserWallet( query, record ) {
9
+ return auditUserWalletModel.updateMany( query, record, { upsert: true } );
10
+ };
@@ -0,0 +1,5 @@
1
+
2
+ import empDetectionOutputModel from 'tango-api-schema/schema/empDetectionOutput.model.js';
3
+ export function createAuditLog( record ) {
4
+ return empDetectionOutputModel.create( record );
5
+ }
@@ -4,3 +4,10 @@ import storeEmpDetectionModel from 'tango-api-schema/schema/storeEmpDetection.mo
4
4
  export function aggregateStoreEmpDetection( query ) {
5
5
  return storeEmpDetectionModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
6
6
  }
7
+
8
+ export function updateOneStoreEmpDetection( query, record ) {
9
+ return storeEmpDetectionModel.updateOne( query, { $set: record } );
10
+ }
11
+ export function updateManyStoreEmpDetection( query, record ) {
12
+ return storeEmpDetectionModel.updateMany( query, { $set: record }, { upsert: true } );
13
+ }
@@ -16,3 +16,7 @@ export function createUserAudit( record ) {
16
16
  export function findOneUserAudit( query, fields ) {
17
17
  return userAuditModel.findOne( query, fields );
18
18
  }
19
+
20
+ export function aggregateUserAuditCount( query ) {
21
+ return userAuditModel.aggregate( query );
22
+ }
@@ -1,7 +1,9 @@
1
1
  import userEmpDetectionModel from 'tango-api-schema/schema/userEmpDetection.model.js';
2
+ import { logger } from 'tango-app-api-middleware';
2
3
 
3
4
 
4
5
  export function aggregateUserEmpDetection( query ) {
6
+ logger.info( { seelevt: 'yryruteretwyyyyyyyyyyyyyyyyyyyyyyyyyyyyewe' } );
5
7
  return userEmpDetectionModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
6
8
  }
7
9
 
@@ -12,3 +14,7 @@ export function createUserEmpDetection( record ) {
12
14
  export function findOneUserEmpDetection( query, fields ) {
13
15
  return userEmpDetectionModel.findOne( query, fields );
14
16
  }
17
+
18
+ export function updateOneUserEmpDetection( query, record ) {
19
+ return userEmpDetectionModel.updateOne( query, { $set: record } );
20
+ }