feat: topology, and improves handling

This commit is contained in:
2026-02-17 19:17:13 +07:00
parent e8dbefde43
commit d14f043e7c
145 changed files with 4213 additions and 2861 deletions
@@ -1,22 +1,23 @@
import { wsService } from "../../application/di-container";
import {
ServerCreatedEvent,
ServerDeletedEvent,
ServerUpdatedEvent,
} from "../../domain/events/server-lifecycle.events";
import { eventBus } from "../event-bus";
import { wsService } from "../../application/di-container";
import { logger } from "../logger";
eventBus.subscribe(ServerCreatedEvent, async (event) => {
console.log(`[Event] Server created: ${event.serverId} (${event.serverType})`);
logger.info({ serverId: event.serverId, serverType: event.serverType }, "Server created event");
wsService.broadcast("create", event.serverType, event.serverId);
});
eventBus.subscribe(ServerUpdatedEvent, async (event) => {
console.log(`[Event] Server updated: ${event.serverId}`);
logger.info({ serverId: event.serverId }, "Server updated event");
wsService.broadcast("update", "server", event.serverId);
});
eventBus.subscribe(ServerDeletedEvent, async (event) => {
console.log(`[Event] Server deleted: ${event.serverId}`);
logger.info({ serverId: event.serverId }, "Server deleted event");
wsService.broadcast("delete", "server", event.serverId);
});