♻️ refactor: remove unused code

This commit is contained in:
2026-08-13 02:32:29 +07:00
parent 5a290fcfa5
commit 3df22125dd
29 changed files with 60 additions and 588 deletions
@@ -5,7 +5,6 @@ type EventHandler<T extends DomainEvent = DomainEvent> = (event: T) => void | Pr
export class EventBus {
private handlers = new Map<string, Set<EventHandler>>();
private eventHistory: DomainEvent[] = [];
subscribe<T extends DomainEvent>(
eventClass: { new (...args: any[]): T },
@@ -22,7 +21,6 @@ export class EventBus {
}
async publish<T extends DomainEvent>(event: T): Promise<void> {
this.eventHistory.push(event);
const eventName = event.constructor.name;
const handlers = this.handlers.get(eventName) || [];
for (const handler of handlers) {
@@ -33,14 +31,6 @@ export class EventBus {
}
}
}
getHistory(): DomainEvent[] {
return [...this.eventHistory];
}
clearHistory(): void {
this.eventHistory = [];
}
}
export const eventBus = new EventBus();
@@ -1,7 +1,7 @@
import {
UserSuspendedEvent,
UserUnsuspendedEvent,
} from "../../domain/events/server-lifecycle.events";
} from "../../domain/events/user-lifecycle.events";
import { eventBus } from "../event-bus";
import { logger } from "../logger";
@@ -8,12 +8,6 @@ export class PrismaUserRepository implements UserRepository {
});
}
async findByEmail(email: string): Promise<User | null> {
return await prisma.user.findUnique({
where: { email },
});
}
async findAll(): Promise<User[]> {
return await prisma.user.findMany({
orderBy: { createdAt: "desc" },
@@ -39,8 +33,4 @@ export class PrismaUserRepository implements UserRepository {
where: { id },
});
}
async count(): Promise<number> {
return await prisma.user.count();
}
}