Skip to content

Class Diagram

Ahmet Erdem Bulut edited this page Mar 8, 2026 · 12 revisions
class_diagram_last
.puml code
@startuml
skinparam classAttributeIconSize 0
skinparam linetype ortho

' ══════════════════════════════════
'  ENUMERATIONS
' ══════════════════════════════════

enum UserType {
  STANDARD
  EXPERT
}

enum AvailabilityStatus {
  AVAILABLE
  BUSY
  OFFLINE
}

enum HelpCategory {
  MEDICAL
  FOOD
  SHELTER
  TRANSPORT
}

enum UrgencyLevel {
  LOW
  MEDIUM
  HIGH
  CRITICAL
}

enum RequestStatus {
  OPEN
  IN_PROGRESS
  RESOLVED
  CLOSED
}

enum VoteType {
  UPVOTE
  DOWNVOTE
}

enum NotificationType {
  EMERGENCY
  HELP_REQUEST
  FORUM
  SYSTEM
}

enum ConnectivityStatus {
  ONLINE
  OFFLINE
}

' ══════════════════════════════════
'  ACCOUNT MANAGEMENT
' ══════════════════════════════════

class Location {
  - latitude : Double
  - longitude : Double
  - timestamp : DateTime
}

class User {
  - userId : Long
  - email : String
  - username : String
  - passwordHash : String
  - name : String
  - userType : UserType
  - isVerified : Boolean
  - location : Location
  - availabilityStatus : AvailabilityStatus
  - createdAt : DateTime
  + signUp() : void
  + logIn() : void
  + logOut() : void
  + selectUserType(type : UserType) : void
  + updateAvailability(status : AvailabilityStatus) : void
  + listResources() : List<Resource>
  + addResource(resource : Resource) : void
  + removeResource(resourceId : Long) : void
  + reportContent(report : Report) : void
  + sendMessage(receiver : User, content : String) : Message
}

class Expert {
  - expertiseFields : List<String>
  - skills : List<Skill>
  - badgeVerified : Boolean
  - badgeLabel : String
  + selectExpertiseField(field : String) : void
  + listExpertiseFields() : List<String>
  + addSkill(skill : Skill) : void
  + listSkills() : List<Skill>
  + publishAdvice(post : ForumPost) : void
}

User <|-- Expert

class Resource {
  - resourceId : Long
  - name : String
  - description : String
  - quantity : Integer
}

class Skill {
  - skillId : Long
  - name : String
  - description : String
}

class AccountService {
  + verifyAccount(user : User) : Boolean
  + verifyExpertBadge(expert : Expert) : Boolean
  + validateCredentials(email : String, password : String) : User
}

AccountService ..> User : verifies >
AccountService ..> Expert : verifies badge >

User "1" -- "0..*" Resource : offers >
Expert "1" -- "0..*" Skill : possesses >

' ── Enum dependencies: Account Management ──
User ..> UserType 
User ..> AvailabilityStatus 

' ══════════════════════════════════
'  FORUM SYSTEM
' ══════════════════════════════════

class ForumPost {
  - postId : Long
  - title : String
  - content : String
  - author : User
  - isExpertPost : Boolean
  - voteCount : Integer
  - createdAt : DateTime
  - updatedAt : DateTime
  + edit(newContent : String) : void
  + getVoteCount() : Integer
  + updateVoteCount() : void
  + addVote(userId : Long, voteType : VoteType) : void
  + getComments(postId : Long) : List<ForumComment>
}

class ForumComment {
  - commentId : Long
  - content : String
  - author : User
  - post : ForumPost
  - createdAt : DateTime
}

class Vote {
  - voteId : Long
  - voter : User
  - postId : Long
  - voteType : VoteType
  - createdAt : DateTime
}

class ForumSearchService {
  + search(query : String) : List<ForumPost>
  + filterByPosterType(type : UserType) : List<ForumPost>
  + browseAll() : List<ForumPost>
  + getPostDetails(postId : Long) : ForumPost
}

User "1" -- "0..*" ForumPost : authors >
ForumPost "1" -- "0..*" ForumComment : has >
User "1" -- "0..*" ForumComment : writes >
ForumPost "1" -- "0..*" Vote : receives >
User "1" -- "0..*" Vote : casts >

' ── Enum dependencies: Forum System ──
Vote ..> VoteType 
ForumSearchService ..> UserType

' ══════════════════════════════════
'  EMERGENCY NOTIFICATION & RESPONSE
' ══════════════════════════════════

class HelpRequest {
  - requestId : Long
  - category : HelpCategory
  - urgencyLevel : UrgencyLevel
  - description : String
  - location : Location
  - status : RequestStatus
  - requester : User
  - respondingExpertTag : String
  - createdAt : DateTime
  + updateStatus(status : RequestStatus) : void
  + setExpertRespondingTag(expert : Expert) : void
  + displayExpertRespondingTag() : String
}

class HelpRequestComment {
  - commentId : Long
  - content : String
  - author : User
  - helpRequest : HelpRequest
  - createdAt : DateTime
}

class HelpOffer {
  - offerId : Long
  - category : HelpCategory
  - skillOrResource : String
  - description : String
  - availability : String
  - offerer : User
  - createdAt : DateTime
}

class Notification {
  - notificationId : Long
  - recipient : User
  - type : NotificationType
  - title : String
  - message : String
  - isRead : Boolean
  - relatedRequestId : Long
  - createdAt : DateTime
  + markAsRead() : void
  + sendPushNotification() : void
}

class NotificationService {
  + sendEmergencyNotification(request : HelpRequest, recipients : List<Expert>) : void
  + sendPushNotification(notification : Notification) : void
  + filterByRoleAndProximity(request : HelpRequest) : List<User>
}

User "1" -- "0..*" HelpRequest : submits >
HelpRequest "1" -- "0..*" HelpRequestComment : has >
User "1" -- "0..*" HelpRequestComment : writes >
User "1" -- "0..*" HelpOffer : creates >
HelpRequest "1" -- "1" Location : locatedAt >
User "1" -- "0..*" Notification : receives >
HelpRequest "1" -- "0..*" Notification : triggers >
NotificationService ..> Notification : creates >
NotificationService ..> HelpRequest : reads >

' ── Enum dependencies: Emergency ──
HelpRequest ..> HelpCategory
HelpRequest ..> UrgencyLevel 
HelpRequest ..> RequestStatus 
HelpOffer ..> HelpCategory 
Notification ..> NotificationType 

' ══════════════════════════════════
'  OFFLINE MODE & GATHERING POINTS
' ══════════════════════════════════

class GatheringPoint {
  - pointId : Long
  - name : String
  - description : String
  - location : Location
}

class CachedData {
  - cacheId : Long
  - dataType : String
  - content : String
  - lastUpdated : DateTime
  - deviceId : String
  + refresh() : void
  + purge() : void
}

class OfflineModeManager {
  - connectivityStatus : ConnectivityStatus
  - lastOnlineLocation : Location
  + detectConnectivityStatus() : ConnectivityStatus
  + switchToOfflineMode() : void
  + showOfflineIndicator() : Boolean
  + loadCachedMapData() : CachedData
  + cacheCriticalDataPeriodically() : void
  + saveLastLocationPeriodically(location : Location) : void
}

GatheringPoint "1" -- "1" Location : locatedAt >
CachedData "0..*" -- "0..*" GatheringPoint : stores >
OfflineModeManager ..> CachedData : manages >
OfflineModeManager ..> GatheringPoint : loads >
OfflineModeManager ..> Location : tracks >

' ── Enum dependencies: Offline ──
OfflineModeManager ..> ConnectivityStatus

' ══════════════════════════════════
'  MESSAGING & REPORTING
' ══════════════════════════════════

class Message {
  - messageId : Long
  - sender : User
  - receiver : User
  - content : String
  - sentAt : DateTime
  - isRead : Boolean
}

class Report {
  - reportId : Long
  - reporter : User
  - reportedUserId : Long
  - reportedContentId : Long
  - reason : String
  - createdAt : DateTime
}

User "1" -- "0..*" Message : sends >
User "1" -- "0..*" Message : receives >
User "1" -- "0..*" Report : files >

@enduml

Clone this wiki locally