From df5c5b5d5385a16db0392047bd62840b99985f2d Mon Sep 17 00:00:00 2001 From: RafidMuhymin Date: Thu, 16 May 2024 16:20:48 +0600 Subject: [PATCH 1/2] fized retry worker not working --- src/utils/D1Strapi.ts | 2 +- .../dilmahtea-me-retry-workers/src/utils/sendErrorEmail.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/D1Strapi.ts b/src/utils/D1Strapi.ts index 97df00f..69c476d 100644 --- a/src/utils/D1Strapi.ts +++ b/src/utils/D1Strapi.ts @@ -8,7 +8,7 @@ export default async function D1Strapi( alternateENV?: typeof env, ): Promise { if (!strapiCollections) { - const { results } = await ((env || alternateENV).USERS as D1Database) + const { results } = await ({ ...alternateENV, ...env }.USERS as D1Database) .prepare("SELECT * FROM strapi") .all(); diff --git a/src/workers/dilmahtea-me-retry-workers/src/utils/sendErrorEmail.ts b/src/workers/dilmahtea-me-retry-workers/src/utils/sendErrorEmail.ts index b6ed3da..0efdd1f 100644 --- a/src/workers/dilmahtea-me-retry-workers/src/utils/sendErrorEmail.ts +++ b/src/workers/dilmahtea-me-retry-workers/src/utils/sendErrorEmail.ts @@ -9,7 +9,8 @@ export default async function sendErrorEmail( ) { let notifySales, subject, body; - const { recurringElement } = await D1Strapi(); + // @ts-ignore + const { recurringElement } = await D1Strapi(env); const { DEV_EMAIL, SALES_EMAIL } = recurringElement.data.attributes; From cfbc28114c2f7535feacc706db4b22a8540678c2 Mon Sep 17 00:00:00 2001 From: RafidMuhymin Date: Thu, 16 May 2024 16:21:54 +0600 Subject: [PATCH 2/2] added missing d1 db types --- src/workers/dilmahtea-me-baserow/src/types/env.ts | 3 +++ src/workers/dilmahtea-me-email/src/types/env.ts | 3 +++ src/workers/dilmahtea-me-retry-workers/src/types/env.ts | 3 +++ 3 files changed, 9 insertions(+) diff --git a/src/workers/dilmahtea-me-baserow/src/types/env.ts b/src/workers/dilmahtea-me-baserow/src/types/env.ts index cce0998..29b6c59 100644 --- a/src/workers/dilmahtea-me-baserow/src/types/env.ts +++ b/src/workers/dilmahtea-me-baserow/src/types/env.ts @@ -3,6 +3,9 @@ export interface ENV { CROWDFUNDINGS: KVNamespace; ECOMMERCE_PAYMENTS: KVNamespace; + // D1 + USERS: D1Database; + // BASEROW BASEROW_TOKEN: string; BASEROW_CROWDFUNDING_TABLE_ID: string; diff --git a/src/workers/dilmahtea-me-email/src/types/env.ts b/src/workers/dilmahtea-me-email/src/types/env.ts index d8b2f69..073c347 100644 --- a/src/workers/dilmahtea-me-email/src/types/env.ts +++ b/src/workers/dilmahtea-me-email/src/types/env.ts @@ -7,6 +7,9 @@ export interface ENV { // KV NAMESPACES MAILS: KVNamespace; + // D1 + USERS: D1Database; + // SECRETS CF_SECURE_WORKER_TOKEN: string; } diff --git a/src/workers/dilmahtea-me-retry-workers/src/types/env.ts b/src/workers/dilmahtea-me-retry-workers/src/types/env.ts index 6cca2bc..9b3d94d 100644 --- a/src/workers/dilmahtea-me-retry-workers/src/types/env.ts +++ b/src/workers/dilmahtea-me-retry-workers/src/types/env.ts @@ -5,6 +5,9 @@ export interface ENV { // KV WORKER_REQUESTS: KVNamespace; + // D1 + USERS: D1Database; + // SERVICES EMAIL: Fetcher;