league service
This commit is contained in:
9
apps/website/lib/modules/auth/AuthModule.ts
Normal file
9
apps/website/lib/modules/auth/AuthModule.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AuthProviders, AUTH_REPOSITORY_TOKEN, USER_REPOSITORY_TOKEN } from './AuthProviders';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
providers: AuthProviders,
|
||||
exports: [AUTH_REPOSITORY_TOKEN, USER_REPOSITORY_TOKEN],
|
||||
})
|
||||
export class AuthModule {}
|
||||
30
apps/website/lib/modules/auth/AuthProviders.ts
Normal file
30
apps/website/lib/modules/auth/AuthProviders.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Provider } from '@nestjs/common';
|
||||
|
||||
// Import core interfaces
|
||||
import { IAuthRepository } from '@gridpilot/identity/domain/repositories/IAuthRepository';
|
||||
import { IUserRepository } from '@gridpilot/identity/domain/repositories/IUserRepository';
|
||||
import { Logger } from '@gridpilot/shared/logging/Logger';
|
||||
|
||||
// Import implementations
|
||||
import { InMemoryAuthRepository } from '@gridpilot/adapters/identity/persistence/inmemory/InMemoryAuthRepository';
|
||||
import { InMemoryUserRepository } from '@gridpilot/adapters/identity/persistence/inmemory/InMemoryUserRepository';
|
||||
|
||||
// Import tokens
|
||||
import { LOGGER_TOKEN } from '../logging/LoggingModule';
|
||||
|
||||
// Define injection tokens
|
||||
export const AUTH_REPOSITORY_TOKEN = Symbol('IAuthRepository');
|
||||
export const USER_REPOSITORY_TOKEN = Symbol('IUserRepository');
|
||||
|
||||
export const AuthProviders: Provider[] = [
|
||||
{
|
||||
provide: AUTH_REPOSITORY_TOKEN,
|
||||
useFactory: (logger: Logger) => new InMemoryAuthRepository(logger),
|
||||
inject: [LOGGER_TOKEN],
|
||||
},
|
||||
{
|
||||
provide: USER_REPOSITORY_TOKEN,
|
||||
useFactory: (logger: Logger) => new InMemoryUserRepository(logger),
|
||||
inject: [LOGGER_TOKEN],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user