Skip to content

Commit cde021d

Browse files
authored
Nino question sort (#274)
* fix? * Add new field for question sorting
1 parent 286ac00 commit cde021d

File tree

5 files changed

+5
-2
lines changed

5 files changed

+5
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "InterviewQuestion" ADD COLUMN "position" INTEGER;

apps/api/prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ model InterviewQuestion {
145145
options String[]
146146
disabled Boolean @default(false)
147147
required Boolean @default(false)
148+
position Int?
148149
}
149150

150151
model Email {

apps/api/src/email/email.controller.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ export class EmailController {
5858
'dump-logo-internship.png',
5959
);
6060

61-
console.log('ImagePath: ', imagePath);
62-
6361
if (fs.existsSync(imagePath)) {
6462
res.sendFile(imagePath, {
6563
headers: {

apps/web/src/components/MultistepForm/MultistepForm.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const MultistepForm = <T, FH>({
4545
{interviewQuestions.data &&
4646
interviewQuestions.data
4747
.filter((q) => q.category === currentCategory && !q.disabled)
48+
.sort((a, b) => (a.position ?? 0) - (b.position ?? 0))
4849
.map((q) => <InputHandler form={form} question={q} key={q.id} />)}
4950
</Box>
5051

packages/types/src/question.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type Question = {
2727
registerValue?: any;
2828
category?: QuestionCategory;
2929
disabled?: boolean;
30+
position?: number;
3031
} & (
3132
| { type: QuestionType.Field }
3233
| { type: QuestionType.TextArea }

0 commit comments

Comments
 (0)