|
1 | 1 | import _ from 'lodash'
|
2 | 2 | import { dropDB, setValue } from '../shared/dao'
|
3 | 3 | import { logger } from './logger'
|
4 |
| -import { ApiSequence, retailDomains, IGMApiSequence, RSFapiSequence, RSF_v2_apiSequence } from '../constants' |
| 4 | +import { ApiSequence, retailDomains, IGMApiSequence,IGM2Sequence, RSFapiSequence, RSF_v2_apiSequence } from '../constants' |
5 | 5 | import { validateSchema, isObjectEmpty } from '../utils'
|
6 | 6 | import { checkOnsearchFullCatalogRefresh } from '../utils/Retail/RET11_onSearch/onSearch'
|
7 | 7 | import { checkSelect } from '../utils/Retail/Select/select'
|
@@ -49,6 +49,8 @@ import checkRsfReport from '../utils/RSF/RSF_v2/report'
|
49 | 49 | import checkRsfOnReport from '../utils/RSF/RSF_v2/on_report'
|
50 | 50 | import checkRsfRecon from '../utils/RSF/RSF_v2/recon'
|
51 | 51 | import checkRsfOnRecon from '../utils/RSF/RSF_v2/on_recon'
|
| 52 | +import checkIssueV2 from 'utils/igm/igm2/issue' |
| 53 | +import checkOnIssueV2 from 'utils/igm/igm2/on_issue' |
52 | 54 |
|
53 | 55 | export const validateLogs = async (data: any, domain: string, flow: string) => {
|
54 | 56 | const msgIdSet = new Set()
|
@@ -408,6 +410,89 @@ export const IGMvalidateLogs = (data: any) => {
|
408 | 410 | }
|
409 | 411 | }
|
410 | 412 |
|
| 413 | +export const IGMvalidateLogs2 = (data: any) => { |
| 414 | + let logReport: any = {} |
| 415 | + |
| 416 | + |
| 417 | + try { |
| 418 | + dropDB() |
| 419 | + } catch (error) { |
| 420 | + logger.error('!!Error while removing LMDB', error) |
| 421 | + } |
| 422 | + |
| 423 | + try { |
| 424 | + if (data[IGM2Sequence.ISSUE_1]) { |
| 425 | + const issue_1 = checkIssueV2(data[IGM2Sequence.ISSUE_1]) |
| 426 | + |
| 427 | + if (!_.isEmpty(issue_1)) { |
| 428 | + logReport = { ...logReport, [IGM2Sequence.ISSUE_1]: issue_1 } |
| 429 | + } |
| 430 | + } |
| 431 | + |
| 432 | + if (data[IGM2Sequence.ON_ISSUE_1]) { |
| 433 | + const on_issue_1 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_1],IGM2Sequence.ON_ISSUE_1) |
| 434 | + |
| 435 | + if (!_.isEmpty(on_issue_1)) { |
| 436 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: on_issue_1 } |
| 437 | + } |
| 438 | + } |
| 439 | + |
| 440 | + if(data[IGM2Sequence.ON_ISSUE_2]){ |
| 441 | + const on_issue_2 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_2],IGM2Sequence.ON_ISSUE_2 ) |
| 442 | + |
| 443 | + if (!_.isEmpty(on_issue_2)) { |
| 444 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: on_issue_2 } |
| 445 | + } |
| 446 | + } |
| 447 | + |
| 448 | + if(data[IGM2Sequence.ISSUE_2]){ |
| 449 | + const on_issue_2 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_2],IGM2Sequence.ISSUE_2 ) |
| 450 | + |
| 451 | + if (!_.isEmpty(on_issue_2)) { |
| 452 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: on_issue_2 } |
| 453 | + } |
| 454 | + } |
| 455 | + |
| 456 | + if (data[IGM2Sequence.ON_ISSUE_3]) { |
| 457 | + const on_issue_3 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_3],IGM2Sequence.ON_ISSUE_3) |
| 458 | + |
| 459 | + if (!_.isEmpty(on_issue_3)) { |
| 460 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_3]: on_issue_3 } |
| 461 | + } |
| 462 | + } |
| 463 | + |
| 464 | + if(data[IGM2Sequence.ON_ISSUE_4]){ |
| 465 | + const ON_ISSUE_4 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_4],IGM2Sequence.ISSUE_4 ) |
| 466 | + |
| 467 | + if (!_.isEmpty(ON_ISSUE_4)) { |
| 468 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_4]: ON_ISSUE_4} |
| 469 | + } |
| 470 | + } |
| 471 | + |
| 472 | + if(data[IGM2Sequence.ISSUE_3]){ |
| 473 | + const ISSUE_3 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_3],IGM2Sequence.ISSUE_3 ) |
| 474 | + |
| 475 | + if (!_.isEmpty(ISSUE_3)) { |
| 476 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: ISSUE_3 } |
| 477 | + } |
| 478 | + } |
| 479 | + |
| 480 | + if(data[IGM2Sequence.ON_ISSUE_5]){ |
| 481 | + const on_issue_5 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_5],IGM2Sequence.ON_ISSUE_5 ) |
| 482 | + |
| 483 | + if (!_.isEmpty(on_issue_5)) { |
| 484 | + logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_5]: on_issue_5 } |
| 485 | + } |
| 486 | + } |
| 487 | + |
| 488 | + logger.info(logReport, 'Report Generated Successfully!!') |
| 489 | + return logReport |
| 490 | + } catch (error: any) { |
| 491 | + logger.error(error.message) |
| 492 | + return error.message |
| 493 | + } |
| 494 | +} |
| 495 | + |
411 | 496 | export const RSFvalidateLogs = (data: any) => {
|
412 | 497 | let logReport: any = {}
|
413 | 498 |
|
|
0 commit comments