From f12d47f86065fb92507034f9ad2ebed64ea0c42e Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Mon, 11 Sep 2023 10:15:44 +0300 Subject: [PATCH] diagrams --- .github/workflows/puml.yaml | 27 +++++++++++++++++++++++++++ diagrams/add-token.puml | 19 +++++++++++++++++++ diagrams/notifications-read.puml | 21 +++++++++++++++++++++ diagrams/register-chat.puml | 11 +++++++++++ diagrams/token-validation.puml | 24 ++++++++++++++++++++++++ 5 files changed, 102 insertions(+) create mode 100644 .github/workflows/puml.yaml create mode 100644 diagrams/add-token.puml create mode 100644 diagrams/notifications-read.puml create mode 100644 diagrams/register-chat.puml create mode 100644 diagrams/token-validation.puml diff --git a/.github/workflows/puml.yaml b/.github/workflows/puml.yaml new file mode 100644 index 0000000..3238609 --- /dev/null +++ b/.github/workflows/puml.yaml @@ -0,0 +1,27 @@ +--- +name: puml +on: + push: + paths: + - '**.puml' + branches: + - master +permissions: + contents: write +jobs: + plantuml: + runs-on: ubuntu-20.04 + steps: + - name: Checkout Source + uses: actions/checkout@v2 + - name: Generate SVG Diagrams + uses: holowinski/plantuml-github-action@main + with: + args: -v -tsvg diagrams/*.puml + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + author_name: h1alexbel + author_email: hialexbel@gmail.com + message: 'diagram generated' + add: 'diagrams/*' diff --git a/diagrams/add-token.puml b/diagrams/add-token.puml new file mode 100644 index 0000000..e4f275d --- /dev/null +++ b/diagrams/add-token.puml @@ -0,0 +1,19 @@ +@startuml +title Add Token Success Flow +actor TelegramUser as user +participant Bot as bot +participant Hub as hub +database Database as db +participant Auth as auth +participant GitHub as github + +user -> bot : Chat ID, Token, TokenAlias +bot -> hub : Chat ID, Token, TokenAlias +hub -> auth: Validate token +auth -> github: Auth token +github --> auth: Auth response +auth --> hub: Auth response +hub -> db: Chat ID, Token, TokenAlias +hub --> bot: Chat ID, TokenAlias status +bot --> user: Chat ID, TokenAlias status +@enduml diff --git a/diagrams/notifications-read.puml b/diagrams/notifications-read.puml new file mode 100644 index 0000000..e2d8fec --- /dev/null +++ b/diagrams/notifications-read.puml @@ -0,0 +1,21 @@ +@startuml +title Notifications Read Flow +actor TelegramUser as user +participant Bot as bot +participant Hub as hub +queue Broker as broker +database Database as db +participant Notifications as notifications +participant GitHub as github + +notifications -> hub +hub -> db: All toggled aliases +db --> hub: Chat ID:Token, TokenAlias +hub --> notifications: Chat ID:Token, TokenAlias +notifications -> github: Polling by token +github --> notifications: Notifications Stream +notifications -> broker: Tuple ID, Notifications Stream +bot -> broker +broker --> bot: Tuple ID, Notifications Stream +bot --> user: Chat ID, TokenAlias:Notifications Stream +@enduml diff --git a/diagrams/register-chat.puml b/diagrams/register-chat.puml new file mode 100644 index 0000000..d8831bd --- /dev/null +++ b/diagrams/register-chat.puml @@ -0,0 +1,11 @@ +@startuml +title Register Chat ID Flow +actor TelegramUser as user +participant Bot as bot +participant Hub as hub +database Database as db + +user -> bot: /chat-id +bot -> hub: Chat ID +hub -> db: Chat ID +@enduml diff --git a/diagrams/token-validation.puml b/diagrams/token-validation.puml new file mode 100644 index 0000000..6168692 --- /dev/null +++ b/diagrams/token-validation.puml @@ -0,0 +1,24 @@ +@startuml +title Token Validation Process +actor TelegramUser as user +participant Bot as bot +participant Hub as hub +database Database as db +participant Auth as auth +participant GitHub as github + +loop every 30 minutes + auth -> hub + hub -> db: All tokens + db --> hub: Chat ID, Tokens + hub --> auth: Chat ID, Tokens + auth -> github: Validate token + github --> auth: Validation status + alt Token expired + auth -> hub: Chat ID, Token, TokenAlias expired + hub -> db: Chat ID, Token, TokenAlias expired status + auth -> bot: Chat ID, Token expired + bot --> user: Chat ID, Token expired + end +end +@enduml