refactor(marketing-pages): binders take BindContext arg

This commit is contained in:
2026-05-09 12:42:29 +02:00
parent fe85976440
commit fe6c41b69d
3 changed files with 17 additions and 31 deletions

View File

@@ -1,4 +1,3 @@
import type { SanitizedConfig } from "payload";
import {
withSpan,
withCapture,
@@ -6,8 +5,7 @@ import {
type ITracer,
type ILogger,
} from "@repo/core-shared/instrumentation";
import type { IEventBus } from "@repo/core-events";
import type { IRealtimeBroadcaster, IRealtimeHandlerRegistry } from "@repo/core-realtime";
import type { BindProductionContext } from "@repo/core-shared/di";
import type { IJobQueue } from "@repo/core-shared/jobs";
import { marketingPagesContainer } from "./container";
import { MARKETING_PAGES_SYMBOLS } from "./symbols";
@@ -23,15 +21,9 @@ import { sendWelcomeEmailJob } from "../jobs/send-welcome-email.job";
import { RecordingMailerService } from "../infrastructure/services/recording-mailer.service";
import type { IMailerService } from "../application/services/mailer.service.interface";
export function bindProductionMarketingPages(
config: SanitizedConfig,
tracer: ITracer,
logger: ILogger,
bus: IEventBus,
queue: IJobQueue,
realtime: IRealtimeBroadcaster,
realtimeRegistry: IRealtimeHandlerRegistry,
): void {
export function bindProductionMarketingPages(ctx: BindProductionContext): void {
const { config, tracer, logger, bus, queue, realtime, realtimeRegistry } = ctx;
// Bind shared instrumentation into feature container
if (marketingPagesContainer.isBound(INSTRUMENTATION_SYMBOLS.TRACER)) {
marketingPagesContainer.unbind(INSTRUMENTATION_SYMBOLS.TRACER);
@@ -148,14 +140,14 @@ export function bindProductionMarketingPages(
layer: "event-handler",
name: "marketing-pages.onAuthUserSignedUpHandler",
},
onAuthUserSignedUpHandler(queue),
onAuthUserSignedUpHandler(queue as IJobQueue),
),
);
if (marketingPagesContainer.isBound(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler)) {
marketingPagesContainer.unbind(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler);
}
marketingPagesContainer.bind(MARKETING_PAGES_SYMBOLS.IOnAuthUserSignedUpHandler).toConstantValue(wrappedAuthUserSignedUp);
bus.subscribe(userSignedUpEvent, "marketing-pages", wrappedAuthUserSignedUp);
bus?.subscribe(userSignedUpEvent, "marketing-pages", wrappedAuthUserSignedUp);
// <gen:jobs>
const wrappedSendWelcomeEmail = withSpan(
tracer,