From 412f3d60ca275e58ad4c8b5fced867acfaf3a2d6 Mon Sep 17 00:00:00 2001 From: Behzad Rabiei <53224485+Behzad-rabiei@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:09:09 +0330 Subject: [PATCH] add ANNOUNCEMENT_SAFETY_MESSAGE --- package.json | 2 +- src/enums/event.enum.ts | 1 + src/saga/choreography.ts | 11 +++++++++-- src/saga/transaction.ts | 9 +++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5d085fe..5eee3d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@togethercrew.dev/tc-messagebroker", - "version": "0.0.44", + "version": "0.0.45", "description": "a service that include common things that need in every microservies ", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/src/enums/event.enum.ts b/src/enums/event.enum.ts index 3ed27fa..77d133c 100644 --- a/src/enums/event.enum.ts +++ b/src/enums/event.enum.ts @@ -14,6 +14,7 @@ enum AnalyzerEvent { const ServerEvent = { UPDATE_GUILD: 'UPDATE_GUILD', + ANNOUNCEMENT_SAFETY_MESSAGE: 'ANNOUNCEMENT_SAFETY_MESSAGE' }; const DiscordBotEvent = { diff --git a/src/saga/choreography.ts b/src/saga/choreography.ts index 5713a7a..5ca2d63 100644 --- a/src/saga/choreography.ts +++ b/src/saga/choreography.ts @@ -5,7 +5,8 @@ import { DISCORD_UPDATE_CHANNELS_TRANSACTIONS, TWITTER_REFRESH_TRANSACTIONS, ANNOUNCEMENT_SEND_MESSAGE_TO_USER_TRANSACTIONS, - ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL_TRANSACTIONS + ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL_TRANSACTIONS, + ANNOUNCEMENT_SAFETY_MESSAGE_TRANSACTIONS } from './transaction'; /* define the DISCORD_UPDATE_CHANNELS choreography */ @@ -40,6 +41,11 @@ const ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL: IChoreography = { transactions: ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL_TRANSACTIONS } +const ANNOUNCEMENT_SAFETY_MESSAGE: IChoreography = { + name: 'ANNOUNCEMENT_SAFETY_MESSAGE', + transactions: ANNOUNCEMENT_SAFETY_MESSAGE_TRANSACTIONS +} + /* all available Choreographies, will grow overtime */ export const ChoreographyDict = { DISCORD_UPDATE_CHANNELS, @@ -51,6 +57,7 @@ export const ChoreographyDict = { // Announcement ANNOUNCEMENT_SEND_MESSAGE_TO_USER, - ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL + ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL, + ANNOUNCEMENT_SAFETY_MESSAGE } as const; diff --git a/src/saga/transaction.ts b/src/saga/transaction.ts index 2124cab..3a96b5b 100644 --- a/src/saga/transaction.ts +++ b/src/saga/transaction.ts @@ -99,4 +99,13 @@ export const ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL_TRANSACTIONS: ITransaction[] = order: 1, ...DEFAULT_TRANSACTION_PROPERTY, } +] + +export const ANNOUNCEMENT_SAFETY_MESSAGE_TRANSACTIONS: ITransaction[] = [ + { + queue: Queue.SERVER_API, + event: Event.SERVER_API.ANNOUNCEMENT_SAFETY_MESSAGE, + order: 1, + ...DEFAULT_TRANSACTION_PROPERTY, + } ] \ No newline at end of file