Skip to content

Commit

Permalink
Merge pull request #104 from RupalSingla/master
Browse files Browse the repository at this point in the history
igm 2.0 review
  • Loading branch information
sandeepshahi authored Feb 18, 2025
2 parents 5cffd86 + a501873 commit a2afc08
Show file tree
Hide file tree
Showing 6 changed files with 613 additions and 3 deletions.
20 changes: 20 additions & 0 deletions constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,26 @@ export const IGMApiSequence = {
LSP_ON_ISSUE_STATUS: 'lsp_on_issue_status',
}

export const IGM2Flows ={
FLOW_1: 'FLOW_1',
FLOW_2: 'FLOW_2',
FLOW_3: 'FLOW_3',
}
export const IGM2Sequence = {
"ISSUE_1": "issue_1",
"ON_ISSUE_1": "on_issue_1",
"ON_ISSUE_2": "on_issue_2",
"ISSUE_2": "issue_2",
"ON_ISSUE_3": "on_issue_3",
"ON_ISSUE_4": "on_issue_4",
"ISSUE_3": "issue_3",
"ON_ISSUE_5": "on_issue_5",
"ON_ISSUE_6": "on_issue_6",
"ISSUE_4": "issue_4",
"ON_ISSUE_7": "on_issue_7",
"ISSUE_5": "issue_5",
}

export const RSFapiSequence = {
RECEIVER_RECON: 'receiver_recon',
ON_RECEIVER_RECON: 'on_receiver_recon',
Expand Down
18 changes: 17 additions & 1 deletion controller/validate/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _ from 'lodash'
import { sign, hash } from '../../shared/crypto'
import { logger } from '../../shared/logger'
import { DOMAIN, ERROR_MESSAGE } from '../../shared/types'
import { IGMvalidateLogs, validateLogs, RSFvalidateLogs, RSFvalidateLogsV2 } from '../../shared/validateLogs'
import { IGMvalidateLogs, validateLogs, RSFvalidateLogs, RSFvalidateLogsV2, IGMvalidateLogs2 } from '../../shared/validateLogs'
import { validateLogsForFIS12 } from '../../shared/Actions/FIS12Actions'
import { validateLogsForMobility } from '../../shared/Actions/mobilityActions'
import { validateLogsForMetro } from '../../shared/Actions/metroActions'
Expand Down Expand Up @@ -190,13 +190,29 @@ const validateIGM = async (payload: string, version: string) => {
}

break
case '2.0.0':
response = IGMvalidateLogs2(payload)

if (_.isEmpty(response)) {
success = true
message = ERROR_MESSAGE.LOG_VERIFICATION_SUCCESSFUL
}

break

default:
message = ERROR_MESSAGE.LOG_VERIFICATION_INVALID_VERSION
logger.warn('Invalid Version!!')
}



return { response, success, message }
}




const validateRSF = async (payload: string, version: string) => {
logger.info('Entering validateRSF function')
let response
Expand Down
2 changes: 1 addition & 1 deletion controller/validate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const controller = {
const { response, success, message } = await helper.validateIGM(payload, version)
result = { response, success, message }
break
case DOMAIN.RSF:
case DOMAIN.RSF:
{
const { response, success, message } = await helper.validateRSF(payload, version)
result = { response, success, message }
Expand Down
87 changes: 86 additions & 1 deletion shared/validateLogs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash'
import { dropDB, setValue } from '../shared/dao'
import { logger } from './logger'
import { ApiSequence, retailDomains, IGMApiSequence, RSFapiSequence, RSF_v2_apiSequence } from '../constants'
import { ApiSequence, retailDomains, IGMApiSequence,IGM2Sequence, RSFapiSequence, RSF_v2_apiSequence } from '../constants'
import { validateSchema, isObjectEmpty } from '../utils'
import { checkOnsearchFullCatalogRefresh } from '../utils/Retail/RET11_onSearch/onSearch'
import { checkSelect } from '../utils/Retail/Select/select'
Expand Down Expand Up @@ -49,6 +49,8 @@ import checkRsfReport from '../utils/RSF/RSF_v2/report'
import checkRsfOnReport from '../utils/RSF/RSF_v2/on_report'
import checkRsfRecon from '../utils/RSF/RSF_v2/recon'
import checkRsfOnRecon from '../utils/RSF/RSF_v2/on_recon'
import checkIssueV2 from 'utils/igm/igm2/issue'
import checkOnIssueV2 from 'utils/igm/igm2/on_issue'

export const validateLogs = async (data: any, domain: string, flow: string) => {
const msgIdSet = new Set()
Expand Down Expand Up @@ -408,6 +410,89 @@ export const IGMvalidateLogs = (data: any) => {
}
}

export const IGMvalidateLogs2 = (data: any) => {
let logReport: any = {}


try {
dropDB()
} catch (error) {
logger.error('!!Error while removing LMDB', error)
}

try {
if (data[IGM2Sequence.ISSUE_1]) {
const issue_1 = checkIssueV2(data[IGM2Sequence.ISSUE_1])

if (!_.isEmpty(issue_1)) {
logReport = { ...logReport, [IGM2Sequence.ISSUE_1]: issue_1 }
}
}

if (data[IGM2Sequence.ON_ISSUE_1]) {
const on_issue_1 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_1],IGM2Sequence.ON_ISSUE_1)

if (!_.isEmpty(on_issue_1)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: on_issue_1 }
}
}

if(data[IGM2Sequence.ON_ISSUE_2]){
const on_issue_2 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_2],IGM2Sequence.ON_ISSUE_2 )

if (!_.isEmpty(on_issue_2)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: on_issue_2 }
}
}

if(data[IGM2Sequence.ISSUE_2]){
const on_issue_2 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_2],IGM2Sequence.ISSUE_2 )

if (!_.isEmpty(on_issue_2)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: on_issue_2 }
}
}

if (data[IGM2Sequence.ON_ISSUE_3]) {
const on_issue_3 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_3],IGM2Sequence.ON_ISSUE_3)

if (!_.isEmpty(on_issue_3)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_3]: on_issue_3 }
}
}

if(data[IGM2Sequence.ON_ISSUE_4]){
const ON_ISSUE_4 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_4],IGM2Sequence.ISSUE_4 )

if (!_.isEmpty(ON_ISSUE_4)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_4]: ON_ISSUE_4}
}
}

if(data[IGM2Sequence.ISSUE_3]){
const ISSUE_3 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_3],IGM2Sequence.ISSUE_3 )

if (!_.isEmpty(ISSUE_3)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_1]: ISSUE_3 }
}
}

if(data[IGM2Sequence.ON_ISSUE_5]){
const on_issue_5 = checkOnIssueV2(data[IGM2Sequence.ON_ISSUE_5],IGM2Sequence.ON_ISSUE_5 )

if (!_.isEmpty(on_issue_5)) {
logReport = { ...logReport, [IGM2Sequence.ON_ISSUE_5]: on_issue_5 }
}
}

logger.info(logReport, 'Report Generated Successfully!!')
return logReport
} catch (error: any) {
logger.error(error.message)
return error.message
}
}

export const RSFvalidateLogs = (data: any) => {
let logReport: any = {}

Expand Down
Loading

0 comments on commit a2afc08

Please sign in to comment.