30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
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],
|
|
},
|
|
]; |