Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

refactor(session): drop the unused findByName lookup

Yudhi Armyndharis24c8cc527129
diff --git a/src/modules/session/session.service.spec.ts b/src/modules/session/session.service.spec.ts
index 17d2375df..ed7051603 100644
--- a/src/modules/session/session.service.spec.ts
+++ b/src/modules/session/session.service.spec.ts
@@ -687,7 +687,7 @@ describe('SessionService', () => {
});
});
- // ── findAll / findOne / findByName ────────────────────────────────
+ // ── findAll / findOne ─────────────────────────────────────────────
describe('findAll', () => {
it('should return all sessions ordered by createdAt DESC', async () => {
@@ -890,22 +890,6 @@ describe('SessionService', () => {
});
});
- describe('findByName', () => {
- it('should return session by name', async () => {
- const session = createMockSession();
- (repository.findOne as jest.Mock).mockResolvedValue(session);
-
- const result = await service.findByName('test-session');
- expect(result.name).toBe('test-session');
- });
-
- it('should throw NotFoundException if name not found', async () => {
- (repository.findOne as jest.Mock).mockResolvedValue(null);
-
- await expect(service.findByName('nonexistent')).rejects.toThrow(NotFoundException);
- });
- });
-
// ── delete ────────────────────────────────────────────────────────
describe('delete', () => {
diff --git a/src/modules/session/session.service.ts b/src/modules/session/session.service.ts
index 3363474c2..3ef39ded6 100644
--- a/src/modules/session/session.service.ts
+++ b/src/modules/session/session.service.ts
@@ -267,14 +267,6 @@ export class SessionService implements OnModuleDestroy, OnModuleInit, OnApplicat
return this.sessionRestrictions.attachTo(this.sessionErrors.attachTo(session));
}
- async findByName(name: string): Promise<Session> {
- const session = await this.sessionRepository.findOne({ where: { name } });
- if (!session) {
- throw new NotFoundException(`Session with name '${name}' not found`);
- }
- return session;
- }
-
/**
* Project the opaque `config` column onto the three keys the engine actually reads, resolved
* through the same clamp the engine uses — so a legacy row holding an out-of-range value reports