driver to user id
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
export const AUTH_REPOSITORY_TOKEN = 'IAuthRepository';
|
||||
export const USER_REPOSITORY_TOKEN = 'IUserRepository';
|
||||
export const PASSWORD_HASHING_SERVICE_TOKEN = 'IPasswordHashingService';
|
||||
export const MAGIC_LINK_REPOSITORY_TOKEN = 'IMagicLinkRepository';
|
||||
export const MAGIC_LINK_REPOSITORY_TOKEN = 'IMagicLinkRepository';
|
||||
export const COMPANY_REPOSITORY_TOKEN = 'ICompanyRepository';
|
||||
@@ -10,8 +10,9 @@ import { InMemoryAuthRepository } from '@adapters/identity/persistence/inmemory/
|
||||
import { InMemoryUserRepository } from '@adapters/identity/persistence/inmemory/InMemoryUserRepository';
|
||||
import { InMemoryPasswordHashingService } from '@adapters/identity/services/InMemoryPasswordHashingService';
|
||||
import { InMemoryMagicLinkRepository } from '@adapters/identity/persistence/inmemory/InMemoryMagicLinkRepository';
|
||||
import { InMemoryCompanyRepository } from '@adapters/identity/persistence/inmemory/InMemoryCompanyRepository';
|
||||
|
||||
import { AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, USER_REPOSITORY_TOKEN, MAGIC_LINK_REPOSITORY_TOKEN } from '../identity/IdentityPersistenceTokens';
|
||||
import { AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, USER_REPOSITORY_TOKEN, MAGIC_LINK_REPOSITORY_TOKEN, COMPANY_REPOSITORY_TOKEN } from '../identity/IdentityPersistenceTokens';
|
||||
|
||||
@Module({
|
||||
imports: [LoggingModule],
|
||||
@@ -48,7 +49,11 @@ import { AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, USER_REPOSITORY_
|
||||
useFactory: (logger: Logger) => new InMemoryMagicLinkRepository(logger),
|
||||
inject: ['Logger'],
|
||||
},
|
||||
{
|
||||
provide: COMPANY_REPOSITORY_TOKEN,
|
||||
useClass: InMemoryCompanyRepository,
|
||||
},
|
||||
],
|
||||
exports: [USER_REPOSITORY_TOKEN, AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, MAGIC_LINK_REPOSITORY_TOKEN],
|
||||
exports: [USER_REPOSITORY_TOKEN, AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, MAGIC_LINK_REPOSITORY_TOKEN, COMPANY_REPOSITORY_TOKEN],
|
||||
})
|
||||
export class InMemoryIdentityPersistenceModule {}
|
||||
@@ -4,11 +4,14 @@ import type { DataSource } from 'typeorm';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
import { UserOrmEntity } from '@adapters/identity/persistence/typeorm/entities/UserOrmEntity';
|
||||
import { CompanyOrmEntity } from '@adapters/identity/persistence/typeorm/entities/CompanyOrmEntity';
|
||||
import { PasswordResetRequestOrmEntity } from '@adapters/identity/persistence/typeorm/entities/PasswordResetRequestOrmEntity';
|
||||
import { TypeOrmAuthRepository } from '@adapters/identity/persistence/typeorm/repositories/TypeOrmAuthRepository';
|
||||
import { TypeOrmUserRepository } from '@adapters/identity/persistence/typeorm/repositories/TypeOrmUserRepository';
|
||||
import { TypeOrmMagicLinkRepository } from '@adapters/identity/persistence/typeorm/repositories/TypeOrmMagicLinkRepository';
|
||||
import { TypeOrmCompanyRepository } from '@adapters/identity/persistence/typeorm/repositories/TypeOrmCompanyRepository';
|
||||
import { UserOrmMapper } from '@adapters/identity/persistence/typeorm/mappers/UserOrmMapper';
|
||||
import { CompanyOrmMapper } from '@adapters/identity/persistence/typeorm/mappers/CompanyOrmMapper';
|
||||
import { InMemoryPasswordHashingService } from '@adapters/identity/services/InMemoryPasswordHashingService';
|
||||
|
||||
import {
|
||||
@@ -16,9 +19,10 @@ import {
|
||||
PASSWORD_HASHING_SERVICE_TOKEN,
|
||||
USER_REPOSITORY_TOKEN,
|
||||
MAGIC_LINK_REPOSITORY_TOKEN,
|
||||
COMPANY_REPOSITORY_TOKEN,
|
||||
} from '../identity/IdentityPersistenceTokens';
|
||||
|
||||
const typeOrmFeatureImports = [TypeOrmModule.forFeature([UserOrmEntity, PasswordResetRequestOrmEntity])];
|
||||
const typeOrmFeatureImports = [TypeOrmModule.forFeature([UserOrmEntity, CompanyOrmEntity, PasswordResetRequestOrmEntity])];
|
||||
|
||||
@Module({
|
||||
imports: [...typeOrmFeatureImports],
|
||||
@@ -43,7 +47,13 @@ const typeOrmFeatureImports = [TypeOrmModule.forFeature([UserOrmEntity, Password
|
||||
useFactory: (dataSource: DataSource, logger: Logger) => new TypeOrmMagicLinkRepository(dataSource, logger),
|
||||
inject: [getDataSourceToken(), 'Logger'],
|
||||
},
|
||||
{
|
||||
provide: COMPANY_REPOSITORY_TOKEN,
|
||||
useFactory: (dataSource: DataSource, mapper: CompanyOrmMapper) => new TypeOrmCompanyRepository(dataSource, mapper),
|
||||
inject: [getDataSourceToken(), CompanyOrmMapper],
|
||||
},
|
||||
{ provide: CompanyOrmMapper, useFactory: () => new CompanyOrmMapper() },
|
||||
],
|
||||
exports: [USER_REPOSITORY_TOKEN, AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, MAGIC_LINK_REPOSITORY_TOKEN],
|
||||
exports: [USER_REPOSITORY_TOKEN, AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, MAGIC_LINK_REPOSITORY_TOKEN, COMPANY_REPOSITORY_TOKEN],
|
||||
})
|
||||
export class PostgresIdentityPersistenceModule {}
|
||||
Reference in New Issue
Block a user