Skip to content

Commit

Permalink
chore: fix typo, adds failsafe on missing formid
Browse files Browse the repository at this point in the history
  • Loading branch information
KenLSM committed Dec 19, 2024
1 parent 3621c80 commit c52f128
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion __tests__/setup/.test-env
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,5 @@ POSTMAN_MOP_CAMPAIGN_ID=campaign_tesst
POSTMAN_MOP_CAMPAIGN_API_KEY=key_test_123
POSTMAN_INTERNAL_CAMPAIGN_ID=campaign_tesst
POSTMAN_INTERNAL_CAMPAIGN_API_KEY=key_test_123
POSTMAN_BASE_URL=https://test.postman.gov.sg/api/v2
POSTMAN_BASE_URL=https://test.postman.gov.sg/api/v2
KILL_EMAIL_MODE_FEEDBACK_FORMID=123123132
6 changes: 4 additions & 2 deletions src/app/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,12 @@ export const optionalVarsSchema: Schema<IOptionalVarsSchema> = {
},
// TODO: (Kill Email Mode) Remove this route after kill email mode is fully implemented.
killEmailMode: {
feedbackFormid: {
feedbackFormId: {
doc: 'Form ID for feedback form in kill email mode',
format: String,
default: null,
// this form id is not part of the critical path,
// thus we don't want to crash the system even if this is not available
default: '',
env: 'KILL_EMAIL_MODE_FEEDBACK_FORMID',
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/routes/api/v3/forms/public-form.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const authAndInjectFeedbackFormUrl: ControllerHandler = (
res,
next,
) => {
const formId = killEmailMode.feedbackFormid
const formId = killEmailMode.feedbackFormId
req.params = { formId: formId }
const sessionUserId = (req.session as AuthedSessionData).user._id

Expand Down
2 changes: 1 addition & 1 deletion src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export interface IOptionalVarsSchema {
useFetchForSubmissions: boolean
}
killEmailMode: {
feedbackFormid: string
feedbackFormId: string
}
publicApi: {
apiKeyVersion: string
Expand Down

0 comments on commit c52f128

Please sign in to comment.