mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 18:34:09 +00:00
a28044dbd4
The module comment no longer spells an @InjectRepository call the scanner took for a foreign Users injection in nest/database, and journey's Users entry is gone now that it reads the Immich flag through UserImmichRepository.
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import { UserAirtrailRepository } from '../../db/repositories/UserAirtrail.repository';
|
|
import { UserImmichRepository } from '../../db/repositories/UserImmich.repository';
|
|
import { UserSynologyRepository } from '../../db/repositories/UserSynology.repository';
|
|
import { EntityManager } from '@mikro-orm/core';
|
|
import { Module } from '@nestjs/common';
|
|
|
|
/**
|
|
* Provides the repositories for the third-party connections a user keeps on
|
|
* their own `users` row (Immich, Synology Photos, AirTrail). They share the
|
|
* `users` table with `UsersRepository`, so MikroORM's one-repository-per-entity
|
|
* injection for the `Users` entity cannot hand them out; each is a factory over the
|
|
* context-resolving global `EntityManager`, as `MaintenanceModule` does, so it
|
|
* resolves the request or transaction fork active when a method runs.
|
|
*/
|
|
@Module({
|
|
providers: [
|
|
{
|
|
provide: UserImmichRepository,
|
|
useFactory: (em: EntityManager) => new UserImmichRepository(em),
|
|
inject: [EntityManager],
|
|
},
|
|
{
|
|
provide: UserSynologyRepository,
|
|
useFactory: (em: EntityManager) => new UserSynologyRepository(em),
|
|
inject: [EntityManager],
|
|
},
|
|
{
|
|
provide: UserAirtrailRepository,
|
|
useFactory: (em: EntityManager) => new UserAirtrailRepository(em),
|
|
inject: [EntityManager],
|
|
},
|
|
],
|
|
exports: [UserImmichRepository, UserSynologyRepository, UserAirtrailRepository],
|
|
})
|
|
export class UserConnectionRepositoriesModule {}
|