mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 09:13:14 +03:00
refactor(server): api keys (#1339)
* refactor: api keys * refactor: test module * chore: tests * chore: fix provider * refactor: test mock repos
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
import { ICryptoRepository, IKeyRepository, IUserRepository } from '@app/domain';
|
||||
import { databaseConfig, UserEntity } from '@app/infra';
|
||||
import { IUserRepository } from '@app/domain';
|
||||
import { Global, Module, Provider } from '@nestjs/common';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { UserRepository } from './db';
|
||||
import { cryptoRepository } from './auth/crypto.repository';
|
||||
import { APIKeyEntity, UserRepository } from './db';
|
||||
import { APIKeyRepository } from './db/repository';
|
||||
|
||||
const providers: Provider[] = [
|
||||
//
|
||||
{ provide: ICryptoRepository, useValue: cryptoRepository },
|
||||
{ provide: IKeyRepository, useClass: APIKeyRepository },
|
||||
{ provide: IUserRepository, useClass: UserRepository },
|
||||
];
|
||||
|
||||
@@ -14,7 +18,7 @@ const providers: Provider[] = [
|
||||
imports: [
|
||||
//
|
||||
TypeOrmModule.forRoot(databaseConfig),
|
||||
TypeOrmModule.forFeature([UserEntity]),
|
||||
TypeOrmModule.forFeature([APIKeyEntity, UserEntity]),
|
||||
],
|
||||
providers: [...providers],
|
||||
exports: [...providers],
|
||||
|
||||
Reference in New Issue
Block a user