FAANG: PromotionService design

 Plant UML:

@startuml

title PromotionService - Class Diagram


' Define external User class from UserService

package "UserService" {

    class User {

        +id: Long

        +username: String

        +email: String

        +phone: String

    }

}


' Define PromotionService entities

package "PromotionService" {

    class PromotionPlan {

        +id: UUID

        +name: String

        +cost: Decimal

        +viewCount: Integer

        +audienceScope: Enum

        +durationDays: Integer

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }


    class Promotion {

        +id: UUID

        +userId: Long

        +eventId: UUID

        +promotionPlanId: UUID

        +purchaseDate: Timestamp

        +status: Enum

        +remainingViews: Integer

        +currentRank: Integer

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }


    class Payment {

        +id: UUID

        +promotionId: UUID

        +userId: Long

        +amount: Decimal

        +paymentDate: Timestamp

        +status: Enum

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }


    class Milestone {

        +id: UUID

        +promotionId: UUID

        +viewCount: Integer

        +achievedAt: Timestamp

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }


    class Discount {

        +id: UUID

        +userId: Long

        +purchaseCount: Integer

        +discountPercentage: Decimal

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }


    class Notification {

        +id: UUID

        +userId: Long

        +promotionId: UUID

        +type: Enum

        +message: String

        +sentAt: Timestamp

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }


    class Event {

        +id: UUID

        +ownerId: Long

        +eventDetails: String

        +date: Date

        +createdAt: Timestamp

        +updatedAt: Timestamp

    }

}


' Define relationships

UserService.User "1" --> "0..*" Promotion : owns

PromotionPlan "1" --> "0..*" Promotion : defines

Promotion "1" --> "1" Payment : has

Promotion "1" --> "0..*" Milestone : tracks

Promotion "1" --> "0..*" Notification : triggers

UserService.User "1" --> "0..*" Payment : makes

UserService.User "1" --> "0..*" Discount : eligible for

UserService.User "1" --> "0..*" Notification : receives

Promotion "0..1" --> "1" Event : promotes


@enduml




















Комментарии

Популярные сообщения из этого блога

Lesson1: JDK, JVM, JRE

SE_21_Lesson_9: Initialization Blocks, Wrapper types, String class

SE_21_Lesson_11: Inheritance, Polymorphism