Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Netflix Assignment #5

Open
Akashpal95 opened this issue Oct 23, 2022 · 0 comments
Open

Netflix Assignment #5

Akashpal95 opened this issue Oct 23, 2022 · 0 comments

Comments

@Akashpal95
Copy link

Exercise

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

  • Netflix has users.
  • Every user has an email and a password.
  • Users can create profiles to have separate independent environments.
  • Each profile has a name and a type. Type can be KID or ADULT.
  • There are multiple videos on netflix.
  • For each video, there will be a title, description and a cast.
  • A cast is a list of actors who were a part of the video. For each actor we need to know their name and list of videos they were a part of.
  • For every video, for any profile who watched that video, we need to know the status (COMPLETED/ IN PROGRESS).
  • For every profile for whom a video is in progress, we want to know their last watch timestamp.

Solution

Class Diagram

classDiagram
    direction LR
    class User {
        +String name
        +String email
        -String password
        -String phone
        +getName() String
        +getEmail() String
        +getPhone() String
    }
    
    class Profile {
        +User user
        +ProfileType type
        +String name
        +Video[] videos
        +getVideoStatus(Video) : String
        +getVideoProgress(Video) : Datetime
    }

    class ProfileType {
        <<enumeration>>
        KID
        ADULT
    }

    Profile "*"-->"1" ProfileType
    User "1"*--"*" Profile : has

    class VideoStatus{
        <<enumeration>>
        COMPLETED
        IN_PROGRESS
        RECOMMENDED
    }

    class Video {
        +String title
        +String description
        +Actor[] cast
    }
    
    class Actor {
        +String name
    }

    Profile "1" --o "*" Video
    Video "*"--o"*" Actor


    
Loading

ER Diagram

erDiagram
    USER {
        int id PK
        varchar name
        varchar email
        varchar password
        varchar phone
    }

    PROFILE {
        int id PK
        varchar name
        enum type
        int user_id FK
    }

    USER ||--|{ PROFILE : creates
    
    VIDEO {
        int id PK
        varchar title
        varchar description
    }
    ACTOR {
        int id PK
        varchar name
    }
    CAST {
        int id PK
        int video_id FK
        int actor_id FK
    }

    PROFILE_VIDEO {
        int id PK
        int profile_id FK
        int video_id FK
    }

    PROFILE ||--o{ PROFILE_VIDEO : has
    VIDEO ||--o{ PROFILE_VIDEO : has
    VIDEO ||--|{ CAST : has
    ACTOR ||--|{ CAST : part_of


Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant