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

Update form input types #146

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Another example [here](https://co-pilot.dev/changelog)
- Remove teamMeetings from response for getSprintDatesByTeamId [#139](https://github.com/chingu-x/chingu-dashboard-be/pull/139)
- Updated response for route GET sprints/meetings/{meetingId} to include updatedAt for agendas [#140](https://github.com/chingu-x/chingu-dashboard-be/pull/140)
- Update test github actions workflow with timeout [#143](https://github.com/chingu-x/chingu-dashboard-be/pull/143)
- Update/Add more form input types [#146](https://github.com/chingu-x/chingu-dashboard-be/pull/146)

### Fixed

Expand Down
14 changes: 13 additions & 1 deletion prisma/seed/data/input-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ export default [
{
name: "text",
},
{
name: "shortText",
},
{
name: "url",
},
{
name: "radio",
},
{
name: "radioIcon",
},
{
name: "radioGroup",
},
Expand All @@ -15,9 +24,12 @@ export default [
name: "number",
},
{
name: "yesNo",
name: "boolean",
},
{
name: "teamMembersCheckbox",
},
{
name: "scale",
},
];
12 changes: 6 additions & 6 deletions prisma/seed/forms/checkinform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const populateCheckinForm = async () => {
order: 4,
inputType: {
connect: {
name: "radio",
name: "radioIcon",
},
},
text: "How would you rate your team's progress right now?",
Expand All @@ -97,13 +97,13 @@ export const populateCheckinForm = async () => {
createMany: {
data: [
{
text: "We have had a good start!",
text: "{{greenRocket}} We have had a good start!",
},
{
text: "I'm nervous we won't finish",
text: "{{amberRocket}} I'm nervous we won't finish",
},
{
text: "It doesn't look good right now",
text: "{{redRocket}} It doesn't look good right now",
},
],
},
Expand Down Expand Up @@ -151,10 +151,10 @@ export const populateCheckinForm = async () => {
order: 5,
inputType: {
connect: {
name: "yesNo",
name: "boolean",
},
},
text: "Did you deploy to Production at the end of this Sprint",
text: "{{Yes,No}}Did you deploy to Production at the end of this Sprint",
answerRequired: true,
},
{
Expand Down
4 changes: 2 additions & 2 deletions prisma/seed/forms/voyage-project-submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export const populateVoyageSubmissionForm = async () => {
order: 8,
inputType: {
connect: {
name: "radio",
name: "scale",
},
},
text: "On a scale of 0-10, how likely are you to suggest Chingu to a friend or colleague?",
text: "{{Not Likely,Extremely Likely}}On a scale of 0-10, how likely are you to suggest Chingu to a friend or colleague?",
answerRequired: true,
optionGroup: {
create: {
Expand Down
7 changes: 5 additions & 2 deletions prisma/seed/responses/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const populateQuestionResponses = async (
responseGroupId: responseGroupId,
};
switch (question.inputType.name) {
case "text": {
case "text":
case "shortText": {
await prisma.response.create({
data: {
...data,
Expand All @@ -81,6 +82,8 @@ export const populateQuestionResponses = async (
});
break;
}
case "scale":
case "radioIcon":
case "radio": {
const radioChoices = await getRandomOptionId(
question.optionGroupId,
Expand Down Expand Up @@ -174,7 +177,7 @@ export const populateQuestionResponses = async (
});
break;
}
case "yesNo": {
case "boolean": {
await prisma.response.create({
data: {
...data,
Expand Down
Loading