admin area
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TypeOrmModule, getDataSourceToken } from '@nestjs/typeorm';
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import { AdminUserOrmEntity } from '@core/admin/infrastructure/typeorm/entities/AdminUserOrmEntity';
|
||||
import { TypeOrmAdminUserRepository } from '@core/admin/infrastructure/typeorm/repositories/TypeOrmAdminUserRepository';
|
||||
import { AdminUserOrmMapper } from '@core/admin/infrastructure/typeorm/mappers/AdminUserOrmMapper';
|
||||
|
||||
import { ADMIN_USER_REPOSITORY_TOKEN } from '../admin/AdminPersistenceTokens';
|
||||
|
||||
const typeOrmFeatureImports = [TypeOrmModule.forFeature([AdminUserOrmEntity])];
|
||||
|
||||
@Module({
|
||||
imports: [...typeOrmFeatureImports],
|
||||
providers: [
|
||||
{ provide: AdminUserOrmMapper, useFactory: () => new AdminUserOrmMapper() },
|
||||
{
|
||||
provide: ADMIN_USER_REPOSITORY_TOKEN,
|
||||
useFactory: (dataSource: DataSource, mapper: AdminUserOrmMapper) =>
|
||||
new TypeOrmAdminUserRepository(dataSource, mapper),
|
||||
inject: [getDataSourceToken(), AdminUserOrmMapper],
|
||||
},
|
||||
],
|
||||
exports: [ADMIN_USER_REPOSITORY_TOKEN],
|
||||
})
|
||||
export class PostgresAdminPersistenceModule {}
|
||||
Reference in New Issue
Block a user