Skip to content

Commit f6e23ee

Browse files
committed
chore: add inputSource to form table field object
1 parent 81ef243 commit f6e23ee

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

packages/backend/src/apps/formsg/__tests__/auth/decrypt-form-response.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { IGlobalVariable, IRequest } from '@plumber/types'
33
import { Settings as LuxonSettings } from 'luxon'
44
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
55

6+
import { FOR_EACH_INPUT_SOURCE } from '@/apps/toolbox/common/constants'
7+
68
import app from '../..'
79
import { decryptFormResponse } from '../../auth/decrypt-form-response'
810
import { NricFilter } from '../../triggers/new-submission'
@@ -763,6 +765,7 @@ describe('decrypt form response', () => {
763765
)}`,
764766
},
765767
],
768+
inputSource: FOR_EACH_INPUT_SOURCE.FORMSG_TABLE,
766769
}),
767770
answerArray: [
768771
['reading', 'night'],
@@ -854,6 +857,7 @@ describe('decrypt form response', () => {
854857
)}`,
855858
},
856859
],
860+
inputSource: FOR_EACH_INPUT_SOURCE.FORMSG_TABLE,
857861
}),
858862
order: 2,
859863
},

packages/backend/src/apps/formsg/common/process-table-field.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { FOR_EACH_INPUT_SOURCE } from '@/apps/toolbox/common/constants'
2+
13
export default function convertTableAnswerArrayToTableObject(
24
answerArray: string[][],
35
) {
@@ -29,5 +31,6 @@ export default function convertTableAnswerArrayToTableObject(
2931
return JSON.stringify({
3032
rows,
3133
columns,
34+
inputSource: FOR_EACH_INPUT_SOURCE.FORMSG_TABLE,
3235
})
3336
}

packages/backend/src/apps/toolbox/actions/for-each/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const tableSchema = z.object({
2323
inputSource: z.enum([
2424
FOR_EACH_INPUT_SOURCE.TILES,
2525
FOR_EACH_INPUT_SOURCE.M365_EXCEL,
26+
FOR_EACH_INPUT_SOURCE.FORMSG_TABLE,
2627
]),
2728
})
2829

0 commit comments

Comments
 (0)