sio:bloc2:2a:td4

Ceci est une ancienne révision du document !


Évaluation Technique Spring Boot - 1h30

Les utilisateurs du Portfolio-builder souhaitent pouvoir recevoir des retours constructifs sur leurs profils de la part de visiteurs ou recruteurs. Vous allez implémenter un système de commentaires avec notation par catégories (présentation, contenu, design).


Profileid: Longusername: String...Commentid: Longcontent: StringauthorName: StringauthorEmail: StringcreatedAt: LocalDateTimestatus: CommentStatusgetAverageScore(): DoubleRatingid: Longscore: Integercategory: RatingCategoryCommentStatusPENDINGAPPROVEDREJECTEDRatingCategoryPRESENTATIONCONTENTDESIGNUn commentaire peut avoir1 à 3 ratings (un par catégorie)score doit être comprisentre 1 et 5receives10..*contains11..3

1. Créer l'enum CommentStatus

  • Valeurs : PENDING, APPROVED, REJECTED

2. Créer l'enum RatingCategory

  • Valeurs : PRESENTATION, CONTENT, DESIGN

3. Créer l'entité Comment

Attributs :

  • id : identifiant auto-généré
  • content : texte de 500 caractères maximum, obligatoire
  • authorName : nom du commentateur, obligatoire
  • authorEmail : email du commentateur, obligatoire
  • createdAt : date/heure de création
  • status : statut du commentaire (enum)

Relations :

  • un commentaire appartient à un profil
  • un commentaire a plusieurs notes
  • les ratings ne peuvent pas exister sans commentaire

4. Créer l'entité Rating

Attributs :

  • id : identifiant auto-généré
  • score : note de 1 à 5, obligatoire
  • category : catégorie de notation (enum)

Relations :

  • une note appartient à un commentaire

5. Créer CommentRepository

  • Hérite de JpaRepository<Comment, Long>
  • Méthode personnalisée : trouver les commentaires par ID de profil ET statut

6. Créer RatingRepository

  • Hérite de JpaRepository<Rating, Long>
  • Méthode personnalisée : trouver toutes les notes d'un commentaire

7. Créer RatingDTO

Attributs :

  • category
  • score

Validations :

  • category : non null
  • score : entre 1 et 5

8. Créer CreateCommentRequest

Attributs :

  • content
  • authorName
  • authorEmail
  • ratings (liste de RatingDTO)

Validations :

  • content : non vide, max 500 caractères
  • authorName : non vide
  • authorEmail : format email valide
  • ratings : non vide

9. Créer CommentDTO

Attributs :

  • id
  • content
  • authorName
  • createdAt
  • status
  • ratings
  • averageScore

<note>Pas de validation nécessaire (DTO de réponse)</note>


Critère Points
Entités : annotations JPA correctes, relations bidirectionnelles cohérentes /4
Repositories : déclarations correctes avec méthodes personnalisées /3
DTOs : structure et validations appropriées /3
  • sio/bloc2/2a/td4.1764549431.txt.gz
  • Dernière modification : il y a 9 jours
  • de jcheron