Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Mar 8, 2024
1 parent f2c5bd6 commit f909adc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/jobs/src/transactions/initial-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ client.defineJob({
const { data: accountsData } = await supabase
.from("bank_accounts")
.select(
"id, team_id, account_id, bank_connection:bank_connection_id(provider, access_token, enrollment_id)"
"id, team_id, account_id, bank_connection:bank_connection_id(provider, access_token)"
)
.eq("team_id", teamId)
.eq("enabled", true)
Expand Down
2 changes: 1 addition & 1 deletion packages/jobs/src/transactions/manual-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ client.defineJob({
const { data: account } = await supabase
.from("bank_accounts")
.select(
"id, team_id, account_id, bank_connection:bank_connection_id(provider, access_token, enrollment_id)"
"id, team_id, account_id, bank_connection:bank_connection_id(provider, access_token)"
)
.eq("id", payload.accountId)
.eq("enabled", true)
Expand Down
26 changes: 13 additions & 13 deletions packages/jobs/src/transactions/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ client.defineJob({
if (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}`
);
}
}

const emailPromises = usersData?.map(async ({ user, team_id }) => {
Expand Down Expand Up @@ -107,13 +107,13 @@ client.defineJob({
if (emailPromises) {
const emailEvents = await Promise.all(emailPromises);

// 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);
}
}
}
},
});
8 changes: 1 addition & 7 deletions packages/jobs/src/transactions/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ client.defineJob({
const { data: accountsData, error: accountsError } = await supabase
.from("bank_accounts")
.select(
"id, team_id, account_id, bank_connection:bank_connection_id(provider, access_token, enrollment_id)"
"id, team_id, account_id, bank_connection:bank_connection_id(provider, access_token)"
)
.eq("team_id", teamId)
.eq("enabled", true);

if (!accountsData?.length) {
// NOTE: Remove all old schedulers
const event = await scheduler.unregister(ctx.source.id);
await io.logger.debug("Unregister", event);
}

if (accountsError) {
await io.logger.error("Accounts Error", accountsError);
}
Expand Down

0 comments on commit f909adc

Please sign in to comment.