ETC-Genie-Logiciel-I/docs/2_Solution/2.1_Conception.md
2023-06-03 18:07:33 -04:00

2.5 KiB

Modèle de conception

hide circles

package Roles {
    hide methods
    hide attributes

    class Admin
    class Mod
    class User
    class Guest
}

Guest <|-- User
User <|-- Mod
Mod <|-- Admin

package Entities {
    hide methods

    class Category {
        string Nom
    }

    class Thread {
        string Titre
        bool EstÉpinglé
        bool EstArchivé
    }

    class Post {
        string Contenu
        string ContenuModifié
        DateTime DateDePublication
        DateTime DateDeModification
        bool EstCachée
    }

    class Account {
        string Pseudo
        string Courriel
        string Description
        string Signature
        string Rôle
    }
}

Category "1" --o "*" Thread
Thread "1" --o "1" Post : Original Post
Thread "1" ---* "*" Post

Post "1" --* "*" Post : References
Post "*" o-- "1" Account

package Views {
    hide methods
    hide attributes

    class CategoryView
    class ThreadView
    class PostView
    class AccountView
}

package Controllers {
    hide attributes

    class CategoryController {
        Category[] AfficherCatégories()
        bool CréerCatégorie(string nom)
        bool ModifierNomCatégorie(Category cat, string nom)
        bool SupprimerCatégorie(Category cat)
    }

    class ThreadController {
        Thread[] ListerFils()
        Thread AfficherFil(string title)
        bool CréerFil(string title, string content)
        bool RépondreAuFil(Thread thr, string content, Post[] ref)
        bool ÉpinglerFil(Thread thr)
        bool ArchiverFil(Thread thr)
    }

    class PostController {
        bool CréerPublication(string content)
        bool ModifierPublication(Post pst, string content)
        bool CacherPublication(Post pst)
    }

    class AccountController {
        Account AfficherCompte(string pseudo)
        bool CréerCompte(string pseudo, string email, string desc, string sign)
        bool ModifierDescription(Account acc, string desc)
        bool ModifierSignature(Account acc, string sign)
        bool ModifierRôle(Account acc, string role)
        bool BannirCompte(Account acc)
    }
}

Guest --> CategoryView
Guest --> ThreadView
Guest --> PostView
Guest --> AccountView

CategoryView --> CategoryController
ThreadView --> ThreadController
PostView --> PostController
AccountView --> AccountController

CategoryController --> Category

ThreadController --> Thread
ThreadController --> Post

PostController --> Post
PostController --> Account

AccountController --> Account