Skip to content

[FEATURE] Réferencer l'id du module plutôt que son slug (PIX-17403) #12033

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

Conversation

yannbertrand
Copy link
Member

@yannbertrand yannbertrand commented Apr 11, 2025

🌸 Problème

Les slugs de module ont tendance à évoluer. C'est gênant pour nos données car on a un lien passage-module qui casse quand ça arrive.

🌳 Proposition

Dans les passages, le moduleId devient le champ id du module.

🐝 Remarques

Impact imprévu : ça a cassé la vérification de réponses, voir les modifs dans element-repository.js.

🤧 Pour tester

Non reg passage de module sur RA.

S'assurer qu'il n'y a pas d'erreur en console.

@yannbertrand yannbertrand self-assigned this Apr 11, 2025
@yannbertrand yannbertrand requested a review from a team as a code owner April 11, 2025 11:49
@pix-bot-github
Copy link

Une fois les applications déployées, elles seront accessibles via les liens suivants :

Les variables d'environnement seront accessibles via les liens suivants :

const id = 'fake-uuid';

// when & then
await expect(moduleDatasource.getById(id)).to.have.been.rejectedWith(LearningContentResourceNotFound);
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiens je connaissais pas 🤩
Une alternative à catchErr ?

Copy link
Member Author

Choose a reason for hiding this comment

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

ahh ouais p'tet bien, c'est du copié collé

@@ -1,10 +1,10 @@
import { requestResponseUtils } from '../../../shared/infrastructure/utils/request-response-utils.js';

const create = async function (request, h, { usecases, passageSerializer }) {
const { 'module-id': moduleId } = request.payload.data.attributes;
const { 'module-id': moduleSlug } = request.payload.data.attributes;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remarque
Est-ce qu'il ne faudrait pas plutôt modifier le front pour passer un moduleId dans le champ request.payload.data.attributes.module-id ?

  • Cela évite d'avoir moduleSlug côté controller puis le moduleId côté usecase
  • Permet, dans le usecase createPassage, d'utiliser la fonction moduleDatasource.getById au lieu de moduleDatasource.getBySlug
  • Fait que l'id est le seul identifiant technique qu'on utilise de bout en bout 😄

C'est pas bloquant et peut être fait dans une autre PR si besoin

Copy link
Member Author

Choose a reason for hiding this comment

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

dans un monde idéal ouais mais ça nécessiterai de casser l'URL d'accès aux modules qui utilise le slug 😅 c'est une feature qu'on veut garder pour l'instant

Copy link
Contributor

@er-lim er-lim left a comment

Choose a reason for hiding this comment

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

Test en RA ✅

Capture d’écran 2025-04-11 à 14 22 17

@pix-service-auto-merge pix-service-auto-merge force-pushed the PIX-17403-passage-references-module-id-instead-of-slug branch from 8eac794 to 3c81d18 Compare April 14, 2025 08:22
@pix-service-auto-merge pix-service-auto-merge merged commit 72a80c6 into dev Apr 14, 2025
9 of 11 checks passed
@pix-service-auto-merge pix-service-auto-merge deleted the PIX-17403-passage-references-module-id-instead-of-slug branch April 14, 2025 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants