diff --git a/server/src/interfaces/session.interface.ts b/server/src/interfaces/session.interface.ts index 3e2c9574a4..62c2ecec7b 100644 --- a/server/src/interfaces/session.interface.ts +++ b/server/src/interfaces/session.interface.ts @@ -2,10 +2,12 @@ import { SessionEntity } from 'src/entities/session.entity'; export const ISessionRepository = 'ISessionRepository'; +type E = SessionEntity; + export interface ISessionRepository { - create(dto: Partial): Promise; - update(dto: Partial): Promise; + create>(dto: T): Promise; + update>(dto: T): Promise; delete(id: string): Promise; - getByToken(token: string): Promise; - getByUserId(userId: string): Promise; + getByToken(token: string): Promise; + getByUserId(userId: string): Promise; } diff --git a/server/src/repositories/session.repository.ts b/server/src/repositories/session.repository.ts index 5e42039bc6..ed2da7a05f 100644 --- a/server/src/repositories/session.repository.ts +++ b/server/src/repositories/session.repository.ts @@ -31,12 +31,12 @@ export class SessionRepository implements ISessionRepository { }); } - create(session: Partial): Promise { - return this.repository.save(session); + create>(dto: T): Promise { + return this.repository.save(dto); } - update(session: Partial): Promise { - return this.repository.save(session); + update>(dto: T): Promise { + return this.repository.save(dto); } @GenerateSql({ params: [DummyValue.UUID] }) diff --git a/server/test/repositories/session.repository.mock.ts b/server/test/repositories/session.repository.mock.ts index 1a034e79f0..d510eb53f7 100644 --- a/server/test/repositories/session.repository.mock.ts +++ b/server/test/repositories/session.repository.mock.ts @@ -3,8 +3,8 @@ import { Mocked, vitest } from 'vitest'; export const newSessionRepositoryMock = (): Mocked => { return { - create: vitest.fn(), - update: vitest.fn(), + create: vitest.fn() as any, + update: vitest.fn() as any, delete: vitest.fn(), getByToken: vitest.fn(), getByUserId: vitest.fn(),