Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Nov 29, 2024
1 parent 3e9c143 commit 5fc561f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
15 changes: 15 additions & 0 deletions apps/dashboard/jobs/utils/generate-cron-tag.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function generateCronTag(teamId: string): string {
// Use teamId to generate a deterministic random minute and hour
const hash = Array.from(teamId).reduce(
(acc, char) => acc + char.charCodeAt(0),
0,
);

// Generate minute (0-59) and hour (0-23) based on hash
const minute = hash % 60;
const hour = hash % 24;

// Return cron expression that runs daily at the generated time
// Format: minute hour * * *
return `${minute} ${hour} * * *`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ export const reconnectGoCardLessLinkAction = authActionClient
},
ctx: { user },
}) => {
await client.institutions[":id"].usage.$put({
param: {
id: institutionId,
},
});

const reference = `${user.team_id}_${nanoid()}`;

const link = new URL(redirectTo);
Expand Down
19 changes: 0 additions & 19 deletions apps/dashboard/src/app/api/test/route.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/engine/src/providers/gocardless/gocardless-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class GoCardLessApi {
#baseUrl = "https://bankaccountdata.gocardless.com";

// Cache keys
#accessTokenCacheKey = "gocardless_access_token_v2";
#refreshTokenCacheKey = "gocardless_refresh_token_v2";
#accessTokenCacheKey = "gocardless_access_token";
#refreshTokenCacheKey = "gocardless_refresh_token";
#institutionsCacheKey = "gocardless_institutions";

#kv: KVNamespace;
Expand Down

0 comments on commit 5fc561f

Please sign in to comment.