Commit Graph

5 Commits

Author SHA1 Message Date
Bastian Wagner
1288f5fc60 fix(mail): resolve templates from __dirname so they exist in the built image
The Docker runtime image only ships dist/, but mail-config.service.ts
pointed at src/mail/mail-templates and nest-cli.json never copied the
.hbs files into dist/ either. This was silently masked before because
the return-before-sendMail bug meant the path was never touched; fixing
that bug now surfaces it as a hard crash on boot (readFileSync throwing
synchronously inside the MailerModule factory). Resolve the templates
dir from __dirname instead, which is correct in both dev (src/mail) and
the compiled image (dist/mail), and add the mail-templates .hbs files
to nest-cli.json's asset copy list so they actually land in dist/.
2026-08-01 09:27:44 +02:00
Bastian Wagner
c80f78594e fix: register mail layout partial on handlebars singleton for real mailer wiring
The HandlebarsAdapter reads partials config from a top-level sibling of
`template` (mailerOptions.options.partials), not from
template.options.partials where it was nested. Because the mail templates
use partial blocks ({{#> layout}}...{{/layout}}), the unregistered partial
rendered silently as an unstyled fragment instead of throwing, so this went
unnoticed. A config-only fix also breaks on Windows because the adapter's
glob-based directory loader mishandles backslash path separators.

Fix registers the shared `layout` partial directly on the handlebars module
singleton in MailConfigService, bypassing the broken glob loader entirely.

Also:
- add mail-config.service.spec.ts, an integration test that drives the real
  MailerOptions + HandlebarsAdapter wiring (would have caught this bug,
  unlike the existing template-only spec which registers the partial itself)
- remove stale nestjs-i18n references from .env.example, env-example, and
  the backend README (i18n was already removed from the code)
- add missing trailing newlines to activation.hbs and reset-password.hbs

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 23:29:19 +02:00
Bastian Wagner
0a0990c6f4 feat(mail): redesign email templates with TeamWallet branding and shared layout partial 2026-07-31 22:49:40 +02:00
Bastian Wagner
247aeefd4c fix(mail): remove dead return before sendMail, add firstName personalization
- Remove I18n dependency injection from MailService constructor
- Hardcode German email subject/body strings directly in the service
- Add optional firstName field to userSignUp and forgotPassword methods
- Wire firstName from user object through auth.service.ts call sites
- Add comprehensive unit tests for MailService

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 22:33:34 +02:00
Bastian Wagner
6bea4f766a first commit 2026-07-31 21:02:47 +02:00