1. User
Attributes:
userID: String
username: String
email: String
password: String
profilePicture: Image
bio: String
followers: List<User>
following: List<User>
Methods:
createProfile()
: Allows the user to create or edit their profile.followUser(user: User)
: Allows the user to follow another user.unfollowUser(user: User)
: Allows the user to unfollow a user.sendMessage(to: User, message: String)
: Sends a direct message to another user.likePost(post: Post)
: Likes a post.commentOnPost(post: Post, comment: String)
: Comments on a post.updateProfile()
: Updates profile information.
2. Post
Attributes:
postID: String
content: String
image: Image
(Optional)video: Video
(Optional)timestamp: DateTime
author: User
likes: List<User>
comments: List<Comment>
Methods:
createPost(content: String, image: Image, video: Video)
: Creates a new post.editPost(content: String)
: Edits the content of a post.deletePost()
: Deletes the post from the system.getComments()
: Retrieves all comments on the post.
3. Comment
Attributes:
commentID: String
text: String
author: User
post: Post
timestamp: DateTime
Methods:
addComment(text: String)
: Adds a new comment to a post.deleteComment()
: Deletes the comment from the post.
4. Message
Attributes:
messageID: String
content: String
sender: User
receiver: User
timestamp: DateTime
Methods:
sendMessage(content: String)
: Sends a message from the sender to the receiver.receiveMessage()
: Allows the receiver to view the message.
5. Notification
Attributes:
notificationID: String
user: User
message: String
timestamp: DateTime
status: String
(e.g., read, unread)
Methods:
createNotification(message: String)
: Creates a new notification for the user.markAsRead()
: Marks the notification as read.
6. Admin
Attributes:
adminID: String
username: String
email: String
Methods:
banUser(user: User)
: Bans a user from the platform.deleteUserAccount(user: User)
: Deletes a user account.moderateContent(post: Post)
: Removes or approves content that violates platform rules.
7. Authentication
Attributes:
authToken: String
user: User
Methods:
login(username: String, password: String)
: Logs the user in by verifying credentials.logout()
: Logs the user out of the system.verifyCredentials()
: Verifies user credentials during login.
Relationships:
- User – Post (1 to many)
A user can create many posts, but a post is authored by one user.
- Post – Comment (1 to many)
A post can have many comments, and a comment is associated with a single post.
- User – Message (many to many)
A user can send many messages to other users, and receive many messages from other users.
- User – Notification (1 to many)
A user can receive many notifications, but a notification is sent to one user.
- Admin – User (1 to many)
An admin can manage multiple users, and a user can be managed by one admin.
Diagram Overview:
- User class is the central entity, with relationships to Post, Comment, Message, Notification, and Admin.
- Admin is a special class, inheriting some methods that allow it to manage the users and the content.
- Post and Comment classes hold the content for user interaction, where the Post has multiple Comments.