Skip to content

Latest commit

 

History

History
248 lines (204 loc) · 7.6 KB

DIAGRAMS.md

File metadata and controls

248 lines (204 loc) · 7.6 KB

Sequence Diagrams

Table of Contents

Successful sign up

Expected payload sent by the user should be:

{
  "username": "joseph.cooper",
  "password": "12345678",
  "email": "[email protected]"
}
sequenceDiagram
    User->>Auth Service: send sign up form
    Auth Service->>Auth Service: validate form
    Auth Service->>Database: check username availability
    Database->>Auth Service: username available
    Auth Service->>Database: insert user
    Database->>Auth Service: user successfully inserted
    Auth Service->>Auth Service: generate auth and refresh tokens
    Auth Service->>User: auth + refresh tokens
Loading

Unsuccessful sign up - invalid form

sequenceDiagram
    User->>Auth Service: send sign up form
    Auth Service->>Auth Service: validate form
    Auth Service->>User: invalid form
Loading

Unsuccessful sign up - username already taken

sequenceDiagram
    User->>Auth Service: send sign up form
    Auth Service->>Auth Service: validate form
    Auth Service->>Database: check username availability
    Database->>Auth Service: username already taken
    Auth Service->>User: username already taken
Loading

Successful sign in

Expected payload sent by the user:

{
  "username": "joseph.cooper",
  "password": "12345678",
}
sequenceDiagram
    User->>Auth Service: send sign in form
    Auth Service->>Auth Service: validate form
    Auth Service->>Database: check user
    Database->>Auth Service: user found
    Auth Service->>Auth Service: validate password
    Auth Service->>Auth Service: generate auth and refresh tokens
    Auth Service->>User: auth + refresh tokens
Loading

Unsuccessful sign in - invalid form

sequenceDiagram
    User->>Auth Service: send sign in form
    Auth Service->>Auth Service: validate form
    Auth Service->>User: invalid form
Loading

Unsuccessful sign in - user not found

sequenceDiagram
    User->>Auth Service: send sign in form
    Auth Service->>Auth Service: validate form
    Auth Service->>Database: check user
    Database->>Auth Service: user not found
    Auth Service->>User: failed to sign in
Loading

Unsuccessful sign in - invalid password

sequenceDiagram
    User->>Auth Service: send sign in form
    Auth Service->>Auth Service: validate form
    Auth Service->>Database: check user
    Database->>Auth Service: user found
    Auth Service->>Auth Service: validate password
    Auth Service->>User: failed to sign in
Loading

Successful image processing

Expected payload sent by the user:

First, should upload the image as a file. The user will receive an imageId as a response.

Then, send the following payload:

{
  "image": "imageId",
  "size": "50%",
  "format": "jpeg",
  "quality": "50"
}
sequenceDiagram
    User->>TinyImg Service: send image
    TinyImg Service->>TinyImg Service: validate image
    TinyImg Service->>TinyImg Service: store image
    TinyImg Service->>File Storage: store image
    File Storage->>TinyImg Service: image stored
    TinyImg Service->>Database: store image
    Database->>TinyImg Service: image stored
    TinyImg Service--)Message Queue: send image to be processed
    TinyImg Service->>User: image processing started
    Message Queue->>FFmpeg Service: message received
    FFmpeg Service--)Message Queue: notify image received
    Message Queue--)Notification Service: notify image received
    Notification Service->>User: image processing started
    FFmpeg Service->>FFmpeg Service: load image
    FFmpeg Service->>Message Queue: notify image loaded
    Message Queue--)Notification Service: notify image loaded
    FFmpeg Service->>FFmpeg Service: process image
    FFmpeg Service--)Message Queue: notify image processed
    Message Queue--)Notification Service: notify image processed
    Notification Service->>User: image processed
    FFmpeg Service->>FFmpeg Service: store processed image
    FFmpeg Service--)Message Queue: notify image stored
    Message Queue--)Notification Service: notify image stored
    Notification Service->>User: image stored and ready
Loading

Unsuccessful image processing - image too big

sequenceDiagram
    User->>TinyImg Service: send image
    TinyImg Service->>TinyImg Service: validate image
    TinyImg Service->>User: image too big
Loading

Unsuccessful image processing - too many images

sequenceDiagram
    User->>TinyImg Service: send image
    TinyImg Service->>TinyImg Service: validate image
    TinyImg Service->>User: too many images
Loading

Unsuccessful image processing - image processing error

sequenceDiagram
    User->>TinyImg Service: send image
    TinyImg Service->>TinyImg Service: validate image
    TinyImg Service->>TinyImg Service: store image
    TinyImg Service--)Message Queue: send image to be processed
    TinyImg Service->>User: image processing started
    Message Queue->>FFmpeg Service: message received
    FFmpeg Service--)Message Queue: notify image received
    Message Queue--)Notification Service: notify image received
    Notification Service->>User: image processing started
    FFmpeg Service->>FFmpeg Service: load image
    FFmpeg Service->>Message Queue: notify image loaded
    Message Queue--)Notification Service: notify image loaded
    FFmpeg Service->>FFmpeg Service: process image
    FFmpeg Service--)Message Queue: notify image processed
    Message Queue--)Notification Service: notify image processed
    Notification Service->>User: image processing error
Loading

Successful image download

sequenceDiagram
    User->>TinyImg Service: request image download
    TinyImg Service->>TinyImg Service: validate download
    TinyImg Service->>TinyImg Service: download image
    TinyImg Service->>User: image downloaded
Loading

Unsuccessful image download - too many downloads

sequenceDiagram
    User->>TinyImg Service: request image download
    TinyImg Service->>TinyImg Service: validate download
    TinyImg Service->>User: too many downloads
Loading

Successful image share

sequenceDiagram
    User->>TinyImg Service: request image share
    TinyImg Service->>TinyImg Service: validate share
    TinyImg Service->>TinyImg Service: share image
    TinyImg Service->>User: image shared
Loading

Unsuccessful image share - too many shares

sequenceDiagram
    User->>TinyImg Service: request image share
    TinyImg Service->>TinyImg Service: validate share
    TinyImg Service->>User: too many shares
Loading