kanmaytacker / design-patterns

Implementation of Gang of Four design patterns in Java
103 stars 206 forks source link

Netflix Assigment #3

Open Faizahmadfaiz opened 1 year ago

Faizahmadfaiz commented 1 year ago

Take Home Exercise

Design the class Diagram and database Schema for a system like Netflix with following Use Cases.

MY SOLUTION

NETFLIX

Class Diagram

classDiagram
direction TB
    class User {
        -String email
        -String password
    }

    class Profile {
        -User user
        -String name
        -ProfileType type
        -Video[] videos
    }

    class ProfileType {
        <<enumeration>>
        ADULT
        KID
    }

    class VideoStatus {
        <<enumeration>>
        COMPLETED
        IN_PROGRESS
    }

    class Video {
        -String title
        -String descripiton
        -Actor[] cast
    }

    class Actor {
        -String name
    }

    class ProfileVideo {
        Profile profile
        Video video
        VideoStatus status
        DateTime timeStamp
    }

    User "1" *-- "*" Profile
    Actor "*" o-- "*" Video
    Video "*" o-- "*" Profile
    Profile *-- ProfileVideo
    Video *-- ProfileVideo
erDiagram
    USER {
        int id PK
        String email
        String passoword
    }

    PROFILE {
        int id PK
        String type
        int user_id FK
    }

    ACTOR {
        int id PK
        String name
    }

    VIDEO {
        int id PK
        String title
        String description
    }

    ACTOR_VIDEO {
        int actor_id FK "Composite PK"
        int video_id FK "Composite PK"
    }

    VIDEOSTATUS {
        int id PK
        String name
    }

    PROFILE_VIDEO {
        int profile_id FK "Composte PK"
        int video_id FK "Composite PK"
        int video_status_id FK
        DateTime timestamp 
    }
Faizahmadfaiz commented 1 year ago

Above tables are very small. How to make it bigger (using mermaid)?