Skip to content

Commit

Permalink
Merge pull request #52 from TogetherCrew/51-announcement-v2
Browse files Browse the repository at this point in the history
add ANNOUNCEMENT_SAFETY_MESSAGE
  • Loading branch information
scientiststwin authored Feb 22, 2024
2 parents 0a2abf3 + 41901b0 commit f881036
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion __tests__/unit/choreography.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('choreography exists', () => {
describe('ANNOUNCEMENT_SEND_MESSAGE_TO_USER', () => {
checkChoreography(ChoreographyDict.ANNOUNCEMENT_SEND_MESSAGE_TO_USER, {
choreographyName: 'ANNOUNCEMENT_SEND_MESSAGE_TO_USER',
transactionsLength: 1,
transactionsLength: 3,
});
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/enums/event.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum AnalyzerEvent {

const ServerEvent = {
UPDATE_GUILD: 'UPDATE_GUILD',
ANNOUNCEMENT_SAFETY_MESSAGE: 'ANNOUNCEMENT_SAFETY_MESSAGE'
};

const DiscordBotEvent = {
Expand Down
4 changes: 2 additions & 2 deletions src/saga/choreography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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,
} from './transaction';

/* define the DISCORD_UPDATE_CHANNELS choreography */
Expand Down Expand Up @@ -51,6 +51,6 @@ export const ChoreographyDict = {

// Announcement
ANNOUNCEMENT_SEND_MESSAGE_TO_USER,
ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL
ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL,

} as const;
16 changes: 14 additions & 2 deletions src/saga/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,21 @@ export const TWITTER_REFRESH_TRANSACTIONS: ITransaction[] = [
export const ANNOUNCEMENT_SEND_MESSAGE_TO_USER_TRANSACTIONS: ITransaction[] = [
{
queue: Queue.DISCORD_BOT,
event: Event.DISCORD_BOT.SEND_MESSAGE,
event: Event.DISCORD_BOT.SEND_MESSAGE_TO_CHANNEL,
order: 1,
...DEFAULT_TRANSACTION_PROPERTY,
},
{
queue: Queue.SERVER_API,
event: Event.SERVER_API.ANNOUNCEMENT_SAFETY_MESSAGE,
order: 2,
...DEFAULT_TRANSACTION_PROPERTY,
},
{
queue: Queue.DISCORD_BOT,
event: Event.DISCORD_BOT.SEND_MESSAGE,
order: 3,
...DEFAULT_TRANSACTION_PROPERTY,
}
]

Expand All @@ -99,4 +111,4 @@ export const ANNOUNCEMENT_SEND_MESSAGE_TO_CHANNEL_TRANSACTIONS: ITransaction[] =
order: 1,
...DEFAULT_TRANSACTION_PROPERTY,
}
]
]

0 comments on commit f881036

Please sign in to comment.