Skip to content

Class Diagram

Mert Cengiz edited this page Oct 16, 2024 · 6 revisions
---

---
classDiagram
    Profile "1" *-- "*" Post
    Profile "1" *-- "*" Like
    Profile "1" *-- "*" Comment
    Profile "1" *-- "*" Collection
    Post "1" o-- "*" Label
    Post "1" *-- "*" Like
    Post "1" *-- "*" Comment
    Collection "1" o-- "*" Post
    RegisteredUser "1" *-- "1" Profile
    Administrator -- Notification
    Image -- Post
    Image -- Profile
    Video -- Post
    Video -- Profile
    User <|-- RegisteredUser
    RegisteredUser <|-- Trainer
    RegisteredUser <|-- Trainee
    RegisteredUser <|-- Dietician
    User <|-- GuestUser
    User <|-- Administrator
    DietProgram "1" *-- "*" Nutrition
    TrainingProgram "1" *-- "*" Exercise
    Dietician "1" *-- "*" DietProgram
    Trainer "1" *-- "*" TrainingProgram

    
    
    
    
    User : -String username
    User : +getFeed() List~Post~

    class RegisteredUser{
        -String email
        -String password
        -String name
        -String surname
        -Profile profile
        -bool isSuspended        
        +logout()
        +changePassword(String oldPassword, String newPassword)
    }

    class GuestUser{
        +login(String username, String password)
        +register(String username, String email, String password)
    }

    class Trainer {
        -List~TrainingProgram~ programs
        +createTrainingProgram(TrainingProgram newProgram)
    }
    
    class Trainee {
        +joinTrainingProgram(TrainingProgram program)
        +joinDietProgram(DietProgram program)
    }

    class Dietician {
        -List~DietProgram~ programs
        +createDietProgram(DietProgram newProgram)
    }

    class TrainingProgram {
        -TrainingType trainingType
        -List~Exercise~ exercises
        -Trainer trainer
        -String frequency
        -String description
        -String name
    }

    class Exercise {
        -List~Muscles~ targetedMuscles
        -String description
        -String name
    }

    class DietProgram {
        -List~Nutrition~
        -Double totalCalorie
        -Dietician dietician
        -String name
        -String description
        +calculateTotalCalorie(List~Nutrition~)
    }

    class Nutrition {
        -String name
        -Double caloriePerGram
        -Double amount
    }

    class Administrator{
        -String email
        -String password
        -String registrationDate
        +logout()
        +changePassword(String oldPassword, String newPassword)
        +sendNotification(Notification notification)
        +suspendUser(String username, String suspensionDate)
        +getNumberOfUsers() int
        +getNumberOfPosts() int
    }

    class Profile{
        -RegisteredUser user
        -String userType
        -String registrationDate
        -String bio
        -Image profilePicture
        -List~Post~ posts
        -List~Comment~ comments
        -List~Like~ likes
        -List~RegisteredUser~ followers
        -List~RegisteredUser~ following
        -List~RegisteredUser~ blockedUsers
        -List~Collection~ collection
        +getFollowers(int profileId) List~RegisteredUser~
        +getFollowing(int profileId) List~RegisteredUser~
        +getNumberOfFollowers(int profileId) int
        +getNumberOfFollowing(int profileId) int
        +follow(RegisteredUser userToFollow)
        +unfollow(RegisteredUser userToUnfollow)
        +blockUser(RegisteredUser userToBlock)
    }

    class Post{
        -int postId
        -RegisteredUser user
        -String title
        -String content
        -String videoUrl
        -Image image
        -List~Comment~ comments
        -List~Label~ labels        
        +createPost(RegisteredUser user, String title, String content, Image image, List~Label~ labels) Post
        +getPost(int postId) Post
        +getAllPosts() List~Post~
        +editPost(int postId, String title, String content, Image image, List~Label~ labels)
        +deletePost(int postId)
        +getPostsOfUser(RegisteredUser user) List~Post~
        +getComments(postID) List~Comment~
        +addLabel(int postId, Label label)
        +deleteLabel(int postId, Label label)
    }

    class Like{
        -int likeId
        -Post post
        -RegisteredUser user
        +getLike(int likeId) Like
        +getNumberOfLikesForPost(Post post) int
        +getNumberOfLikesForComment(Comment comment) int
        +getLikedPostsForUser(RegisteredUser user) List~Post~
        +likePost(Post post, RegisteredUser user)
        +likeComment(Comment comment, RegisteredUser user)
        +deleteLike(int likeId)
    }

    class Comment{
        -int commentId
        -Post post
        -RegisteredUser user
        -String content
        +getComment(int commentId) Comment
        +getCommentsOfUser(RegisteredUser user) List~RegisteredUser~
        +createComment(String content)
        +editComment(String content)
        +deleteComment(int commentId)
    }

    class Label{
        -int labelId
        -String name
        -String type
        +getName(labelID: int) String
        +getType(labelID: int) String
    }
    
    class Collection{
        -int collectionId
        -String name
        -RegisteredUser user
        -List~Post~ listOfPosts
        +createCollection(String name, RegisteredUser user)
        +addPostToCollection(int collectionId, Post post)
        +deletePostFromCollection(int collectionId, Post post)
        +deleteCollection(int collectionId)
    }

    class Notification{
        -int notificationId
        -String title
        -String content
    }
    
    class Search {
        +searchUsers(String query) List~RegisteredUser~
        +searchPosts(String query) List~Post~
        +searchTrainingProgram(String query) List~TrainingProgram~
        +searchDietProgram(String query) List~DietProgram~
    }

    class Image {
        -URL image
        +getURL()
    }

   class Video {
        -URL video
        +getURL()
    }
Loading
Clone this wiki locally