Commit 6b179696 authored by Santosh Mattikoppa's avatar Santosh Mattikoppa
Browse files

#SB-24675 feat: Generate AUDIT telemetry for program-service API's

Showing with 12 additions and 12 deletions
+12 -12
...@@ -29,20 +29,20 @@ function generateAuditEvent(DBinstance, model, action) { ...@@ -29,20 +29,20 @@ function generateAuditEvent(DBinstance, model, action) {
}; };
event['context'] = { event['context'] = {
pdata: telemetryEventConfig.pdata, pdata: telemetryEventConfig.pdata,
env: model.name, env: model.name,
channel: envVariables.DOCK_CHANNEL || "sunbird", channel: envVariables.DOCK_CHANNEL || "sunbird",
} }
event['edata'] = { event['edata'] = {
type: action, type: action,
state: DBinstance.status || '', state: DBinstance.status || '',
prevstate: action === 'create' ? '' : DBinstance.previous().status || DBinstance.status, prevstate: action === 'create' ? '' : DBinstance.previous().status || DBinstance.status,
props: _.keys(DBinstance.previous()) props: _.keys(DBinstance.previous())
} }
event['object'] = { event['object'] = {
id: DBinstance[model.primaryKeyAttributes[0]] || '', id: _.get(DBinstance, 'dataValues.program_id') || DBinstance[model.primaryKeyAttributes[0]] || '',
type: model.name, type: model.name,
rollup: {} rollup: {}
} }
logger.info({ msg: 'Audit Event', event }) logger.info({ msg: 'Audit Event', event })
telemetryInstance.audit(event); telemetryInstance.audit(event);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment