Skip to content

Commit 5890679

Browse files
authored
feat: Stage 1 - add parseConfig field to Question and OptionChoice models (#238)
* feat: add parseConfig field to Form, Question, and OptionGroup models * feat: Add parseConfig field to OptionChoice model * feat: Add parseConfig to questions and optionChoice seeds with predefined options * refactor: Update parseConfig in checkin and voyage submission forms - Modify rocket status icons to use icon and iconUrl properties - Update boolean and NPS scale options to use more generic min/max keys
1 parent 06e8d63 commit 5890679

File tree

8 files changed

+49
-1
lines changed

8 files changed

+49
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- AlterTable
2+
ALTER TABLE "OptionChoice" ADD COLUMN "parseConfig" JSONB;
3+
4+
-- AlterTable
5+
ALTER TABLE "Question" ADD COLUMN "parseConfig" JSONB;

prisma/schema/form.prisma

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ model Question {
4646
4747
responses Response[]
4848
subQuestions Question[] @relation("QuestionSubQuestion")
49+
parseConfig Json?
4950
}
5051

5152
model InputType {
@@ -67,6 +68,7 @@ model OptionGroup {
6768
6869
optionChoices OptionChoice[]
6970
questions Question[]
71+
7072
}
7173

7274
model OptionChoice {
@@ -79,6 +81,7 @@ model OptionChoice {
7981
updatedAt DateTime @updatedAt
8082
8183
responses Response[]
84+
parseConfig Json?
8285
}
8386

8487
model Response {

prisma/seed/forms/checkinform.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,27 @@ export const populateCheckinForm = async () => {
7474
data: [
7575
{
7676
text: "{{greenRocket}} We have had a good start!",
77+
parseConfig: {
78+
icon: "greenRocket",
79+
iconUrl:
80+
".../greenRocket.png",
81+
},
7782
},
7883
{
7984
text: "{{amberRocket}} I'm nervous we won't finish",
85+
parseConfig: {
86+
icon: "amberRocket",
87+
iconUrl:
88+
".../amberRocket.png",
89+
},
8090
},
8191
{
8292
text: "{{redRocket}} It doesn't look good right now",
93+
parseConfig: {
94+
icon: "redRocket",
95+
iconUrl:
96+
".../redRocket.png",
97+
},
8398
},
8499
],
85100
},
@@ -157,7 +172,11 @@ export const populateCheckinForm = async () => {
157172
name: "boolean",
158173
},
159174
},
160-
text: "{{Yes,No}}Did you deploy to Production at the end of this Sprint?",
175+
text: "{{yes,no}}Did you deploy to Production at the end of this Sprint?",
176+
parseConfig: {
177+
yes: "Yes",
178+
no: "No",
179+
},
161180
answerRequired: true,
162181
},
163182
{

prisma/seed/forms/checkinformSM.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export const populateCheckinFormSM = async () => {
2323
},
2424
},
2525
text: "{{Yes,No}} Did your Scrum Master provide any Scrum training or coaching, either during events or through Discord?",
26+
parseConfig: {
27+
Yes: "Yes",
28+
No: "No",
29+
},
2630
answerRequired: true,
2731
},
2832
{
@@ -33,6 +37,10 @@ export const populateCheckinFormSM = async () => {
3337
},
3438
},
3539
text: "{{Yes,No}} Was your Scrum Master effective in resolving issues and removing impediments during sprints?",
40+
parseConfig: {
41+
Yes: "Yes",
42+
No: "No",
43+
},
3644
answerRequired: true,
3745
},
3846
{
@@ -43,6 +51,10 @@ export const populateCheckinFormSM = async () => {
4351
},
4452
},
4553
text: "{{Yes,No}} Did your Scrum Master work to ensure that all Scrum events ran smoothly, stayed positive and productive, and stayed within the designated timebox?",
54+
parseConfig: {
55+
Yes: "Yes",
56+
No: "No",
57+
},
4658
answerRequired: true,
4759
},
4860
{

prisma/seed/forms/voyage-project-submission.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export const populateVoyageSubmissionForm = async () => {
9494
},
9595
},
9696
text: "{{Not Likely,Extremely Likely}}On a scale of 0-10, how likely are you to suggest Chingu to a friend or colleague?",
97+
parseConfig: {
98+
min: "Not Likely",
99+
max: "Extremely Likely",
100+
},
97101
answerRequired: true,
98102
optionGroup: {
99103
create: {

src/global/mocks/mock-data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export const createMockData = {
203203
multipleAllowed: null,
204204
optionGroupId: null,
205205
parentQuestionId: null,
206+
parseConfig: null,
206207
createdAt: mockDate,
207208
updatedAt: mockDate,
208209
...partial,

src/sprints/sprints.controller.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ describe("SprintsController", () => {
320320
optionChoiceId: null,
321321
createdAt: mockDate,
322322
updatedAt: mockDate,
323+
323324
question: {
324325
id: 1,
325326
text: "Question 1",
@@ -333,7 +334,9 @@ describe("SprintsController", () => {
333334
parentQuestionId: null,
334335
createdAt: mockDate,
335336
updatedAt: mockDate,
337+
parseConfig: null,
336338
},
339+
337340
optionChoice: null,
338341
},
339342
],

src/sprints/sprints.service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ describe("SprintsService", () => {
313313
parentQuestionId: null,
314314
createdAt: mockDate,
315315
updatedAt: mockDate,
316+
parseConfig: null,
316317
},
317318
optionChoice: null,
318319
},

0 commit comments

Comments
 (0)