Skip to content

[FEATURE] Pouvoir enregistrer un NPS pour le moteur de recommandation (PIX-23302)#16626

Merged
dianeCdrPix merged 5 commits into
devfrom
PIX-23302-create-route-to-store-nps
Jun 25, 2026
Merged

[FEATURE] Pouvoir enregistrer un NPS pour le moteur de recommandation (PIX-23302)#16626
dianeCdrPix merged 5 commits into
devfrom
PIX-23302-create-route-to-store-nps

Conversation

@matthiasferraina

@matthiasferraina matthiasferraina commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🪧 Problème

Les campagnes du moteur de recommandations Pix permettent de proposer un NPS (Net Promoter Score) aux utilisateurs à la fin de leur parcours. Il n'existait pas de route API pour enregistrer cette réponse.

🌈 Proposition

Ajouter une route POST /api/user-campaign-surveys permettant à un utilisateur authentifié d'enregistrer son score de satisfaction (1–5) pour une campagne donnée (dans le cadre du moteur de recommandations).

✊ Remarques

  • Un utilisateur ne peut soumettre qu'une seule réponse par campagne
  • La PR pour la création de table a été mergée, pensez à faire un fetch et rebase de ka branche dev

🎉 Pour tester

  • Test verts
  • En local, lancer la migration npm run db:migrate
  • Reconstruire les seeds si ça n'a pas été fait récemment
  • Lancer, en local, une instance API
  • Lancer la commande suivante dans le terminal
TOKEN=$(curl -s -X POST http://localhost:3000/api/token -H "Content-Type: application/x-www-form-urlencoded" -H "x-forwarded-proto: https" -H "x-forwarded-host: app.pix.fr" -d "grant_type=password&username=superadmin@example.net&password=pix123" | jq -r '.access_token')
curl -s -X POST http://localhost:3000/api/user-campaign-surveys -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/vnd.api+json" -H "x-forwarded-proto: https" -H "x-forwarded-host: app.pix.fr" -d '{"data":{"type":"user-campaign-surveys","attributes":{"campaign-id":6001,"satisfaction-score":4}}}'
  • Aller checker qu'il y a des enregistrements dans la table user-campaign-surveys

@pix-bot-github

pix-bot-github commented Jun 24, 2026

Copy link
Copy Markdown

@matthiasferraina matthiasferraina self-assigned this Jun 24, 2026
@matthiasferraina matthiasferraina added team-devcomp Aka la Brigade du 🪩 Kool and the gang 🪩 👀 Tech Review Needed 👀 Func Review Needed Need PO validation for this functionally labels Jun 24, 2026
@matthiasferraina matthiasferraina force-pushed the PIX-23302-create-route-to-store-nps branch from 459975f to 367ff99 Compare June 24, 2026 13:37
@matthiasferraina matthiasferraina added the ⚠️ PR Inheritance This PR inherits a first-to-merge PR and will need a rebase label Jun 24, 2026
@matthiasferraina matthiasferraina changed the title Pix 23302 create route to store nps [FEATURE] Pouvoir enregistrer un NPS pour le moteur de recommandation Jun 24, 2026
@matthiasferraina matthiasferraina changed the title [FEATURE] Pouvoir enregistrer un NPS pour le moteur de recommandation [FEATURE] Pouvoir enregistrer un NPS pour le moteur de recommandation (PIX-23302) Jun 24, 2026
@matthiasferraina matthiasferraina marked this pull request as ready for review June 25, 2026 05:20
@matthiasferraina matthiasferraina requested review from a team as code owners June 25, 2026 05:20
@matthiasferraina matthiasferraina force-pushed the PIX-23302-create-route-to-store-nps branch 2 times, most recently from b330e94 to 2cd828c Compare June 25, 2026 06:42
Comment thread api/db/database-builder/factory/build-user-campaign-survey.js Outdated
Comment thread api/src/devcomp/application/user-campaign-surveys/user-campaign-survey-route.js Outdated
Comment thread api/src/devcomp/domain/usecases/save-user-campaign-survey.js Outdated
Comment thread api/tests/tooling/domain-builder/factory/build-user-campaign-survey.js Outdated
@dianeCdrPix dianeCdrPix removed the ⚠️ PR Inheritance This PR inherits a first-to-merge PR and will need a rebase label Jun 25, 2026
@dianeCdrPix

Copy link
Copy Markdown
Contributor

❌Je viens de lancer localement la commande curl, et j'ai un retour 500 :/
image

matthiasferraina and others added 5 commits June 25, 2026 13:57
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@er-lim

er-lim commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

❌Je viens de lancer localement la commande curl, et j'ai un retour 500 :/

J'ai eu le même problème de mon côté. J'avais oublié le npm run db:migrate 😇

@matthiasferraina matthiasferraina force-pushed the PIX-23302-create-route-to-store-nps branch from 2cd828c to 6018b77 Compare June 25, 2026 11:58

@er-lim er-lim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test en local ✅

@dianeCdrPix

Copy link
Copy Markdown
Contributor

❌Je viens de lancer localement la commande curl, et j'ai un retour 500 :/

Mes seeds n'étaient pas à jour. Maintenant, ÇA MARCHE ! 🎉

image

@dianeCdrPix dianeCdrPix added Tech Review OK Func Review OK PO validated functionally the PR and removed 👀 Func Review Needed Need PO validation for this functionally labels Jun 25, 2026
@dianeCdrPix dianeCdrPix added this pull request to the merge queue Jun 25, 2026
Merged via the queue into dev with commit b27ae54 Jun 25, 2026
12 checks passed
@dianeCdrPix dianeCdrPix deleted the PIX-23302-create-route-to-store-nps branch June 25, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Func Review OK PO validated functionally the PR team-devcomp Aka la Brigade du 🪩 Kool and the gang 🪩 Tech Review OK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants