Skip to content

Commit

Permalink
feat: add helpful value in feedback (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charlesdoiron authored Apr 9, 2024
1 parent eb9b59b commit 00f382e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Feedback" ADD COLUMN "helpful" TEXT,
ALTER COLUMN "score" DROP NOT NULL;
3 changes: 2 additions & 1 deletion api-node/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ model Notification {

model Feedback {
id String @id @default(uuid())
score Int
score Int?
helpful String?
message String?
contact String?
user_id String
Expand Down
4 changes: 3 additions & 1 deletion api-node/src/controllers/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ feedbackRouter.post(
) => {
try {
z.object({
score: z.number(),
score: z.number().optional(),
helpful: z.string().optional(),
message: z.string().optional(),
contact: z.string().optional(),
}).parse(req.body);
Expand All @@ -40,6 +41,7 @@ feedbackRouter.post(
await prisma.feedback.create({
data: {
user_id: req.user.id,
helpful: req.body.helpful,
score: req.body.score,
message: req.body.message,
contact: req.body.contact,
Expand Down
2 changes: 1 addition & 1 deletion api-node/src/getters/indice_atmo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async function getIndiceAtmoFromMunicipalityAndDate({
},
take: 2,
})
.then((recommandations) =>
.then((recommandations: any[]) =>
recommandations.map(
(recommandation) => recommandation.recommandation_content,
),
Expand Down

0 comments on commit 00f382e

Please sign in to comment.