From 20f0aabbd37e57f38417feaad52cd8453e4a6f7c Mon Sep 17 00:00:00 2001 From: Paul LEVRAULT Date: Sun, 26 Nov 2023 18:43:43 +0100 Subject: [PATCH] Ajouter 'Documents/Diagramme/DiagrammeDeClasses/README_issue022.md' --- .../DiagrammeDeClasses/README_issue022.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 Documents/Diagramme/DiagrammeDeClasses/README_issue022.md diff --git a/Documents/Diagramme/DiagrammeDeClasses/README_issue022.md b/Documents/Diagramme/DiagrammeDeClasses/README_issue022.md new file mode 100644 index 00000000..60092a42 --- /dev/null +++ b/Documents/Diagramme/DiagrammeDeClasses/README_issue022.md @@ -0,0 +1,152 @@ +[retour au README.md](../../../README.md) +[Retour aux Documents](../../README_DOCUMENTS.md) + +## Diagramme de classe +- Ajout d'amis +```plantuml +class User { + + name : string +} + +User "1" --> "*" User: friends +User "1" --> "*" Notification: notifications +User "1" --> "*" Ask: friendRequests +class Notification { + - text : string +} + +interface INotifier { + + notify() : void +} + +INotifier --|> Observer + +abstract class UserManager { + - currentUser : User + + deleteFriend(userId : int) : void + + addFriend(userId : int) : void + + respondToFriendRequest(requestId : int, choice : bool) : void + + getFriends(userId : int) : User[] +} + +class Ask { + - fromUser : int + - toUser : int +} + +Ask --|> Subject + +abstract class Subject { + + attach(o : Observer) : void + + detach(o : Observer) : void + + notify() : void +} + +Subject "1" --> "*" Observer +interface Observer { + + update() : void +} + +UserManager ..> User +UserManager o-- IUserRepository +UserManager o-- INotifier + +interface IUserRepository { + + findByUsername(username : string) : User + + addUser(user : User) : bool +} + +IUserRepository ..> User +``` + +## Diagrammes de séquence +- Envoi de demande d'ami : +```plantuml +actor User as u +boundary View as v +control Controller as c +entity Model as m + +u->v:/Friend +v->c:Get : /Friends +c->m:getFriends(userId) +m-->c::friends : User[] +c-->v:renderView(Friends) +v-->u: +u->v:input : name +v->c:Get : searchFriends? pseudo=name +c->m:searchUser(name:string) +m->m:notify(from : user, to : user, action : action) +m-->c:OK +c-->v:OK +v-->u:OK +``` +- Accepter une demande d'ami : +```plantuml +actor User as u +boundary View as v +control Controller as c +entity Model as m + +m->c:RecevoirDemandeAmi(idUser) +c->v:AfficherDemandeAmi(idUser) +v->u:PageDemandeAmi(idUser) +u-->v:RepondreDemandeAmi(bool) +v-->c:EnregistrerReponse(bool) +c-->m:EnvoyerReponse(bool) +``` + +- Supprimer un ami : +```plantuml +actor User as u +boundary View as v +control Controller as c +entity Model as m + +u->v: Request Friends Page +v->c: Get /Friends +c->m: getFriends(userId) +alt successful retrieval + m-->c: friendsList: User[] +else retrieval failed + m-->c: error +end +c-->v: renderView(friendsList) +v-->u: Display Friends + +u->v: clickDeleteFriend(idUser) +v->c: Post: deleteFriend(idUser) +c->m: deleteFriend(idUser) +alt successful deletion + m-->c: updatedFriendsList: User[] +else deletion failed + m-->c: error +end +c-->v: renderView(updatedFriendsList) +v-->u: Display Updated Friends +``` + +## Diagrammes de cas d'utilisation +- Gestion du compte et des amitiés +```plantuml +left to right direction +:Athlete: as a + +a --> (Ajouter un ami) +a --> (Supprimer un ami) +a --> (Voir mes amis) +a --> (Modifier mes informations) +(Ajouter un ami)->(Saisir le nom de l'ami) +(Supprimer un ami)..>(S'authentifier) : <> +(Ajouter un ami)..>(S'authentifier) : <> +(Voir mes amis)..>(S'authentifier) : <> +(Voir mes amis)..>(Lister les amis) : <> +(Modifier mes informations)..>(Informations personnelles) : <> +(Modifier mes informations)..>(Informations de connexion) : <> +(Lister les amis)..>(Voir son profil) : <> +(Voir son profil)..>(Voir ses activités) : <> +(Voir son profil)..>(Voir ses statistiques) : <> +(S'authentifier)..>(S'inscrire) : <> +(S'authentifier)..>(Se connecter) : <> +(S'inscrire)..>(Inscription Athlète) : <> +``` \ No newline at end of file