2023-01-18 15:40:15 +01:00
|
|
|
import { ICryptoRepository, IKeyRepository, IUserRepository } from '@app/domain';
|
2023-01-12 03:34:36 +01:00
|
|
|
import { databaseConfig, UserEntity } from '@app/infra';
|
|
|
|
import { Global, Module, Provider } from '@nestjs/common';
|
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2023-01-18 15:40:15 +01:00
|
|
|
import { cryptoRepository } from './auth/crypto.repository';
|
|
|
|
import { APIKeyEntity, UserRepository } from './db';
|
|
|
|
import { APIKeyRepository } from './db/repository';
|
2023-01-12 03:34:36 +01:00
|
|
|
|
|
|
|
const providers: Provider[] = [
|
|
|
|
//
|
2023-01-18 15:40:15 +01:00
|
|
|
{ provide: ICryptoRepository, useValue: cryptoRepository },
|
|
|
|
{ provide: IKeyRepository, useClass: APIKeyRepository },
|
2023-01-12 03:34:36 +01:00
|
|
|
{ provide: IUserRepository, useClass: UserRepository },
|
|
|
|
];
|
|
|
|
|
|
|
|
@Global()
|
|
|
|
@Module({
|
|
|
|
imports: [
|
|
|
|
//
|
|
|
|
TypeOrmModule.forRoot(databaseConfig),
|
2023-01-18 15:40:15 +01:00
|
|
|
TypeOrmModule.forFeature([APIKeyEntity, UserEntity]),
|
2023-01-12 03:34:36 +01:00
|
|
|
],
|
|
|
|
providers: [...providers],
|
|
|
|
exports: [...providers],
|
|
|
|
})
|
|
|
|
export class InfraModule {}
|