Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Mar 8, 2024
1 parent f909adc commit 022f3e2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/jobs/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const Jobs = {
TRANSACTIONS_EXPORT: "transactions-export",
TRANSACTIONS_NOTIFICATION: "transactions-notification",
TRANSACTION_SCHEDULER: "transaction-scheduler",
TRANSACTIONS_SYNC: "transactions-sync-v2",
TRANSACTIONS_SYNC: "transactions-sync",
TRANSACTIONS_SETUP: "transactions-setup",
PROCESS_DOCUMENT: "process-document",
MATCH_INBOX: "match-inbox",
Expand Down
32 changes: 16 additions & 16 deletions packages/jobs/src/transactions/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ client.defineJob({
}));
});

if (notificationPromises) {
const notificationEvents = await Promise.all(notificationPromises);
const notificationEvents = await Promise.all(notificationPromises);

if (notificationEvents?.length) {
triggerBulk(notificationEvents.flat());
await io.logger.log(
`Sending notifications: ${notificationEvents.length}`
);
}
if (notificationEvents?.length) {
triggerBulk(notificationEvents.flat());
await io.logger.log(
`Sending notifications: ${notificationEvents.length}`
);
}

await io.logger.debug("notificationEvents", notificationEvents);

const emailPromises = usersData?.map(async ({ user, team_id }) => {
const { t } = getI18n({ locale: user.locale });

Expand Down Expand Up @@ -104,15 +104,15 @@ client.defineJob({
};
});

if (emailPromises) {
const emailEvents = await Promise.all(emailPromises);
const emailEvents = await Promise.all(emailPromises);

await io.logger.debug("emailEvents", emailEvents);

if (emailEvents?.length) {
try {
triggerBulk(emailEvents.flat());
} catch (error) {
await io.logger.debug(error);
}
if (emailEvents?.length) {
try {
triggerBulk(emailEvents.flat());
} catch (error) {
await io.logger.debug(error);
}
}
},
Expand Down
8 changes: 7 additions & 1 deletion packages/jobs/src/transactions/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ client.defineJob({
name: Events.TRANSACTIONS_NOTIFICATION,
payload: {
teamId,
transactions: transactionsData,
transactions: transactionsData.map((transaction) => ({
id: transaction.id,
date: transaction.date,
amount: transaction.amount,
name: transaction.name,
currency: transaction.currency,
})),
},
});

Expand Down

0 comments on commit 022f3e2

Please sign in to comment.