From 43f2e030b15c82bc0e45f9a58b22577f350bad4a Mon Sep 17 00:00:00 2001 From: "Dennis (via Claude+Gemma)" Date: Sat, 23 May 2026 08:59:07 +0200 Subject: [PATCH] feat(budget-alerts-email): Email-Stub-Send wenn Project-Budget >100% (in webhookDispatc [tsc:fail] --- .phase27-state.json | 5 +++-- GENERATION_LOG.md | 18 ++++++++++++++++++ apps/api/src/services/email.ts | 6 ++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.phase27-state.json b/.phase27-state.json index a158268..d8ee978 100644 --- a/.phase27-state.json +++ b/.phase27-state.json @@ -1,9 +1,10 @@ { "completed_features": [], - "current_feature": "search-pagination", + "current_feature": "budget-alerts-email", "started_at": "2026-05-23T08:55:38.459472", "attempted_features": [ "advanced-filters", - "bulk-customer-tag" + "bulk-customer-tag", + "search-pagination" ] } \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index 0bda99d..debd7f6 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -3152,3 +3152,21 @@ src/index.ts(27,25): error TS2769: No overload matches this call. Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. Type 'Promise' provides no match for the signature '(instance: FastifyInstance, +- `08:58:44` **INFO** Committed feature search-pagination +- `08:58:44` **INFO** Pushed: rc=0 + +## Phase-3 Feature: budget-alerts-email (2026-05-23 08:58:44) + +- `08:58:44` **INFO** Description: Email-Stub-Send wenn Project-Budget >100% (in webhookDispatcher) +- `08:58:44` **INFO** Generating apps/api/src/services/email.ts (ERWEITERT — behalte alle bestehenden Methoden. Füge sendBudgetExceeded…) +- `08:59:06` **INFO** wrote 2568 chars in 21.4s (attempt 1) +- `08:59:06` **INFO** Running tsc --noEmit on api… +- `08:59:07` **WARN** tsc errors: +src/db/schema.ts(37,14): error TS7022: 'customers' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +src/db/schema.ts(43,59): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +src/db/schema.ts(47,14): error TS7022: 'projects' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer. +src/db/schema.ts(51,56): error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. +src/index.ts(27,25): error TS2769: No overload matches this call. + Overload 1 of 3, '(plugin: FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>, opts?: FastifyRegisterOptions<...> | undefined): FastifyInstance<...> & PromiseLike<...>', gave the following error. + Argument of type 'Promise' is not assignable to parameter of type 'FastifyPluginCallback<{ limits: { fileSize: number; }; }, RawServerDefault, FastifyTypeProvider, FastifyBaseLogger>'. + Type 'Promise' provides no match for the signature '(instance: FastifyInstance, diff --git a/apps/api/src/services/email.ts b/apps/api/src/services/email.ts index 9faf447..26d50c2 100644 --- a/apps/api/src/services/email.ts +++ b/apps/api/src/services/email.ts @@ -52,6 +52,12 @@ class EmailService { await this.send(user.email, subject, body); } + + async sendBudgetExceeded(user: User, project: { name: string }, percent: number) { + const subject = `Budget exceeded for ${project.name}`; + const body = `Hi ${user.name || "there"},\n\nThe budget for project "${project.name}" has been exceeded. Current usage is at ${percent}%. Please review your project settings.`; + await this.send(user.email, subject, body); + } } export const emailService = new EmailService(); \ No newline at end of file