sio:bloc2:2a:td4

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
sio:bloc2:2a:td4 [2025/12/01 01:31] – créée jcheronsio:bloc2:2a:td4 [2025/12/02 20:36] (Version actuelle) – [Partie 2 : Repositories (15 min)] jcheron
Ligne 12: Ligne 12:
  
 ==== Diagramme PlantUML ==== ==== Diagramme PlantUML ====
 +<html><div class="imageB"></html>
 <uml> <uml>
 @startuml @startuml
 +
 +class Profile {
 +  - id: UUID
 +  - username: String
 +  - ...
 +}
 +
 +class Comment {
 +  - id: UUID
 +  - content: String
 +  - authorName: String
 +  - authorEmail: String
 +  - createdAt: LocalDateTime
 +  - status: CommentStatus
 +  + getAverageScore(): Double
 +}
 +
 +class Rating {
 +  - id: UUID
 +  - score: Integer
 +  - category: RatingCategory
 +}
  
 enum CommentStatus { enum CommentStatus {
Ligne 28: Ligne 50:
 } }
  
-entity Profile +Profile "1" -- "0..*" Comment receives > 
-  idLong +Comment "1" *-- "1..3" Rating : contains > 
-  ... +Comment -- CommentStatus 
-}+Rating -- RatingCategory
  
-entity Comment { +note right of Comment 
-  id: Long +  Un commentaire peut avoir 
-  content: String(500+  1 à 3 ratings (un par catégorie
-  authorName: String +end note
-  authorEmail: String +
-  createdAt: LocalDateTime +
-  status: CommentStatus +
-}+
  
-entity Rating +note right of Rating 
-  id: Long +  score doit être compris 
-  score: Integer +  entre 1 et 5 
-  category: RatingCategory +end note
-+
- +
-Profile ||--o{ Comment : "has many" +
-Comment ||--o{ Rating : "has many" +
-Comment }o-- CommentStatus +
-Rating }o-- RatingCategory+
  
 @enduml @enduml
 </uml> </uml>
 +<html></div></html>
 ===== Travail demandé ===== ===== Travail demandé =====
  
Ligne 69: Ligne 81:
  
 Attributs : Attributs :
-  * ''id'' : identifiant auto-généré+  * ''id'' : identifiant UUID
   * ''content'' : texte de 500 caractères maximum, obligatoire   * ''content'' : texte de 500 caractères maximum, obligatoire
   * ''authorName'' : nom du commentateur, obligatoire   * ''authorName'' : nom du commentateur, obligatoire
Ligne 84: Ligne 96:
  
 Attributs : Attributs :
-  * ''id'' : identifiant auto-généré+  * ''id'' : identifiant UUID
   * ''score'' : note de 1 à 5, obligatoire   * ''score'' : note de 1 à 5, obligatoire
   * ''category'' : catégorie de notation (enum)   * ''category'' : catégorie de notation (enum)
Ligne 93: Ligne 105:
 ---- ----
  
-==== Partie 2 : Repositories (10 min) ====+==== Partie 2 : Repositories (15 min) ====
  
 **5. Créer ''CommentRepository''** **5. Créer ''CommentRepository''**
-  * Hérite de ''JpaRepository<Comment, Long>''+  * Hérite de ''JpaRepository<Comment, UUID>''
   * Méthode personnalisée : trouver les commentaires par ID de profil ET statut   * Méthode personnalisée : trouver les commentaires par ID de profil ET statut
  
 **6. Créer ''RatingRepository''** **6. Créer ''RatingRepository''**
-  * Hérite de ''JpaRepository<Rating, Long>''+  * Hérite de ''JpaRepository<Rating, UUID>''
   * Méthode personnalisée : trouver toutes les notes d'un commentaire   * Méthode personnalisée : trouver toutes les notes d'un commentaire
  
Ligne 111: Ligne 123:
   * ''score''   * ''score''
  
-Validations : 
-  * ''category'' : non null 
-  * ''score'' : entre 1 et 5 
  
 **8. Créer ''CreateCommentRequest''** **8. Créer ''CreateCommentRequest''**
Ligne 123: Ligne 132:
   * ''ratings'' (liste de RatingDTO)   * ''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''** **9. Créer ''CommentDTO''**
Ligne 139: Ligne 143:
   * ''ratings''   * ''ratings''
   * ''averageScore''   * ''averageScore''
- 
-<note>Pas de validation nécessaire (DTO de réponse)</note> 
  
  
Ligne 148: Ligne 150:
  
 ^ Critère ^ Points ^ ^ Critère ^ Points ^
-| **Entités** : annotations JPA correctes, relations bidirectionnelles cohérentes | /|+| **Entités** : annotations JPA correctes, relations bidirectionnelles cohérentes | /|
 | **Repositories** : déclarations correctes avec méthodes personnalisées | /3 | | **Repositories** : déclarations correctes avec méthodes personnalisées | /3 |
-| **DTOs** : structure et validations appropriées | /|+| **DTOs** : structure et validations appropriées | /|
  
  • sio/bloc2/2a/td4.1764549070.txt.gz
  • Dernière modification : il y a 10 jours
  • de jcheron