From c1972ef0d05a3b9229427c20d5b67cbaa7412773 Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Mon, 13 Apr 2026 11:50:39 -0700 Subject: [PATCH] feat(backend): emit timer.created event from POST /timers route Wire getEventBus().emit() into the timer creation handler so webhook subscribers and future listeners receive typed domain events. --- backend/src/modules/timers/routes.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/src/modules/timers/routes.ts b/backend/src/modules/timers/routes.ts index 0993bc2..4117853 100644 --- a/backend/src/modules/timers/routes.ts +++ b/backend/src/modules/timers/routes.ts @@ -11,6 +11,7 @@ */ import type { FastifyInstance } from 'fastify'; +import { getEventBus } from '../../lib/event-bus.js'; import { BadRequestError, NotFoundError, ConflictError } from '@bytelyst/errors'; import { extractAuth } from '../../lib/auth.js'; import * as repo from './repository.js'; @@ -106,6 +107,7 @@ export async function timerRoutes(app: FastifyInstance) { req.log.info({ timerId: doc.id, type: doc.type }, 'Creating timer'); const created = await repo.createTimer(doc); + getEventBus().emit('timer.created', { timerId: doc.id, userId: auth.sub, label: doc.label }); reply.code(201); return created; });