Skip to content

Commit 2cbdd62

Browse files
committed
docs: add code flow for send notification flow
1 parent 722fb04 commit 2cbdd62

File tree

1 file changed

+41
-8
lines changed

1 file changed

+41
-8
lines changed
Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ The git repository sends a webhook to the bot if any event occurs. The webhook c
1717
### The bot processes the webhook message
1818

1919
When an application receives a webhook message from the git repository, the bot processes the webhook message.
20-
It checks if the webhook is set or not. If the event has any actions and the event is allowed notify in the settings, etc.
20+
It checks if the webhook is set or not. If the event has any actions and the event is allowed notify in the settings,
21+
etc.
2122

2223
### The bot gets the message details if the event is valid
2324

24-
If the event/action is valid, the bot will get the message details of this event/action and set the message details to the message
25+
If the event/action is valid, the bot will get the message details of this event/action and set the message details to
26+
the message
2527
object.
2628

2729
### The bot sends a notification
@@ -51,8 +53,9 @@ the `telegram-git-notifier` functionality, including configuration and views for
5153

5254
> [!NOTE]
5355
> The following diagram is a simplified version of the entity relationship diagram for the Telegram Git Notifier.
54-
>
55-
> The data is **still saved in JSON format**. I don't use database storage because I don't want to **affect any data on your real system**. Its purpose is only to clarify the feature's operating model.
56+
>
57+
> The data is **still saved in JSON format**. I don't use database storage because I don't want to **affect any data on
58+
your real system**. Its purpose is only to clarify the feature's operating model.
5659

5760
```mermaid
5861
erDiagram
@@ -157,7 +160,37 @@ flowchart TD
157160
log --> endFlow
158161
```
159162

160-
## Future Work
161-
162-
In the future, additional flows will be implemented to handle other aspects of the bot's functionality, such as error
163-
handling, customizing notifications, and sending notifications to multiple users.
163+
## Code flow
164+
165+
Here is the code flow of the Telegram Git Notifier - send notification flow:
166+
167+
```plaintext
168+
Receive webhook from git repository
169+
-> packages/laravel-telegram-git-notifier/src/Http/Actions/IndexAction::class
170+
- Check query type (callback_query, message, webhook[gitlab, github])
171+
- create new NotificationService
172+
- call the handle method of the NotificationService
173+
174+
-> packages/laravel-telegram-git-notifier/src/Services/NotificationService@handle
175+
- Get and set the event from the request in handleEventFromRequest method
176+
- Call the sendNotification method
177+
178+
-> packages/telegram-git-notifier/src/Trait/EventTrait@handleEventFromRequest
179+
- Set event name
180+
- Check and update platform(GitLab, GitHub) for event object
181+
182+
-> go to setPlatFormForEvent method
183+
- Detech and set platform file
184+
- Update event config from platform file
185+
186+
-> go to sendNotification method of this NotificationService
187+
- call validateAccessEvent to check if the event is allowed
188+
- loop through the recipients and send the notification to each recipient
189+
190+
-> packages/telegram-git-notifier/src/Services/NotificationService@validateAccessEvent
191+
- Set payload and message from the event
192+
- Check if the eventis allowed in the settings
193+
- Check if the event/action is allowed in the platform settings
194+
195+
-> packages/telegram-git-notifier/src/Structures/Notification@sendNotify
196+
```

0 commit comments

Comments
 (0)