mirror of
https://github.com/immich-app/immich.git
synced 2024-11-21 18:16:55 +02:00
refactor(server): remove unused on method (#13830)
This commit is contained in:
parent
7961435d36
commit
40fbef50cf
@ -88,7 +88,6 @@ export type EventItem<T extends EmitEvent> = {
|
||||
|
||||
export interface IEventRepository {
|
||||
setup(options: { services: ClassConstructor<unknown>[] }): void;
|
||||
on<T extends keyof EventMap>(item: EventItem<T>): void;
|
||||
emit<T extends keyof EventMap>(event: T, ...args: ArgsOf<T>): Promise<void>;
|
||||
|
||||
/**
|
||||
|
@ -57,7 +57,6 @@ export class EventRepository implements OnGatewayConnection, OnGatewayDisconnect
|
||||
|
||||
setup({ services }: { services: ClassConstructor<unknown>[] }) {
|
||||
const reflector = this.moduleRef.get(Reflector, { strict: false });
|
||||
const repository = this.moduleRef.get<IEventRepository>(IEventRepository);
|
||||
const items: Item<EmitEvent>[] = [];
|
||||
|
||||
// discovery
|
||||
@ -94,7 +93,7 @@ export class EventRepository implements OnGatewayConnection, OnGatewayDisconnect
|
||||
|
||||
// register by priority
|
||||
for (const handler of handlers) {
|
||||
repository.on(handler);
|
||||
this.addHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +133,7 @@ export class EventRepository implements OnGatewayConnection, OnGatewayDisconnect
|
||||
await client.leave(client.nsp.name);
|
||||
}
|
||||
|
||||
on<T extends EmitEvent>(item: EventItem<T>): void {
|
||||
private addHandler<T extends EmitEvent>(item: EventItem<T>): void {
|
||||
const event = item.event;
|
||||
|
||||
if (!this.emitHandlers[event]) {
|
||||
|
@ -4,7 +4,6 @@ import { Mocked, vitest } from 'vitest';
|
||||
export const newEventRepositoryMock = (): Mocked<IEventRepository> => {
|
||||
return {
|
||||
setup: vitest.fn(),
|
||||
on: vitest.fn() as any,
|
||||
emit: vitest.fn() as any,
|
||||
clientSend: vitest.fn() as any,
|
||||
clientBroadcast: vitest.fn() as any,
|
||||
|
Loading…
Reference in New Issue
Block a user