icynet-auth-server/src/modules/objects/oauth2-client/oauth2-client.providers.ts

27 lines
854 B
TypeScript
Raw Normal View History

import { Provider } from '@nestjs/common';
2022-08-18 07:12:02 +00:00
import { DataSource } from 'typeorm';
2022-03-09 18:37:04 +00:00
import { OAuth2ClientAuthorization } from './oauth2-client-authorization.entity';
import { OAuth2ClientURL } from './oauth2-client-url.entity';
import { OAuth2Client } from './oauth2-client.entity';
export const clientProviders: Provider<any>[] = [
2022-03-09 18:37:04 +00:00
{
provide: 'CLIENT_REPOSITORY',
2022-08-18 07:12:02 +00:00
useFactory: (dataSource: DataSource) =>
dataSource.getRepository(OAuth2Client),
inject: ['DATA_SOURCE'],
2022-03-09 18:37:04 +00:00
},
{
provide: 'CLIENT_URL_REPOSITORY',
2022-08-18 07:12:02 +00:00
useFactory: (dataSource: DataSource) =>
dataSource.getRepository(OAuth2ClientURL),
inject: ['DATA_SOURCE'],
2022-03-09 18:37:04 +00:00
},
{
provide: 'CLIENT_AUTHORIZATION_REPOSITORY',
2022-08-18 07:12:02 +00:00
useFactory: (dataSource: DataSource) =>
dataSource.getRepository(OAuth2ClientAuthorization),
inject: ['DATA_SOURCE'],
2022-03-09 18:37:04 +00:00
},
];