Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add createReqMeta to verification module logging #1562

Merged
merged 1 commit into from
Apr 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/modules/verification/verification.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SALT_ROUNDS } from '../../../shared/util/verification'
import { PublicTransaction } from '../../../types'
import { ErrorDto } from '../../../types/api'
import { generateOtpWithHash } from '../../utils/otp'
import { createReqMeta } from '../../utils/request'

import { VerificationFactory } from './verification.factory'
import { Transaction } from './verification.types'
Expand All @@ -30,6 +31,7 @@ export const handleCreateTransaction: RequestHandler<
const logMeta = {
action: 'handleCreateTransaction',
formId,
...createReqMeta(req),
}
return VerificationFactory.createTransaction(formId)
.map((transaction) => {
Expand Down Expand Up @@ -66,6 +68,7 @@ export const handleGetTransactionMetadata: RequestHandler<
const logMeta = {
action: 'handleGetTransactionMetadata',
transactionId,
...createReqMeta(req),
}
return VerificationFactory.getTransactionMetadata(transactionId)
.map((publicTransaction) =>
Expand Down Expand Up @@ -99,6 +102,7 @@ export const handleResetField: RequestHandler<
action: 'handleResetField',
transactionId,
fieldId,
...createReqMeta(req),
}
return VerificationFactory.resetFieldForTransaction(transactionId, fieldId)
.map(() => res.sendStatus(StatusCodes.OK))
Expand Down Expand Up @@ -130,6 +134,7 @@ export const handleGetOtp: RequestHandler<
action: 'handleGetOtp',
transactionId,
fieldId,
...createReqMeta(req),
}
return generateOtpWithHash(logMeta, SALT_ROUNDS)
.andThen(({ otp, hashedOtp }) =>
Expand Down Expand Up @@ -171,6 +176,7 @@ export const handleVerifyOtp: RequestHandler<
action: 'handleVerifyOtp',
transactionId,
fieldId,
...createReqMeta(req),
}
return VerificationFactory.verifyOtp(transactionId, fieldId, otp)
.map((signedData) => res.status(StatusCodes.OK).json(signedData))
Expand Down