refactor(services): rename module services

This commit is contained in:
Aleksandr Bukhalo 2020-01-12 10:53:45 +03:00
parent b67b859810
commit ec99dcd65f
5 changed files with 11 additions and 15 deletions

View File

@ -1 +1 @@
export * from './invalid-configuration.exeption'; export * from './invalid-configuration.exeption'

View File

@ -1,5 +1,5 @@
export * from './telegraf.module' export * from './telegraf.module'
export * from './interfaces' export * from './interfaces'
export * from './decorators' export * from './decorators'
export * from './telegraf-bot.service' export * from './telegraf.service'
export * from './telegraf-telegram-client.service' export * from './telegraf-telegram.service'

View File

@ -5,7 +5,7 @@ import { TokenInjectionToken } from './telegraf.constants'
import { TelegrafOptionsFactory } from './interfaces' import { TelegrafOptionsFactory } from './interfaces'
@Injectable() @Injectable()
export class TelegrafTelegramClientService { export class TelegrafTelegramService {
private telegram: any private telegram: any
public constructor( public constructor(

View File

@ -1,11 +1,7 @@
import { Module, DynamicModule, Provider } from '@nestjs/common' import { Module, DynamicModule, Provider } from '@nestjs/common'
import { TelegrafBotService } from './telegraf-bot.service' import { TelegrafModuleAsyncOptions, TelegrafOptionsFactory } from './interfaces'
import {
TelegrafModuleAsyncOptions,
TelegrafOptionsFactory,
} from './interfaces'
import { TELEGRAF_MODULE_OPTIONS, TokenInjectionToken } from './telegraf.constants' import { TELEGRAF_MODULE_OPTIONS, TokenInjectionToken } from './telegraf.constants'
import { TelegrafTelegramClientService } from './telegraf-telegram-client.service' import { TelegrafService, TelegrafTelegramService } from './'
@Module({}) @Module({})
export class TelegrafModule { export class TelegrafModule {
@ -15,14 +11,14 @@ export class TelegrafModule {
imports: options.imports || [], imports: options.imports || [],
providers: [ providers: [
...this.createAsyncProviders(options), ...this.createAsyncProviders(options),
TelegrafBotService, TelegrafService,
TelegrafTelegramClientService, TelegrafTelegramService,
{ {
provide: TokenInjectionToken, provide: TokenInjectionToken,
useClass: options.useClass, useClass: options.useClass,
}, },
], ],
exports: [TelegrafBotService, TelegrafTelegramClientService], exports: [TelegrafService, TelegrafTelegramService],
} }
} }

View File

@ -14,8 +14,8 @@ import {
import { InvalidConfigurationException } from './exeptions' import { InvalidConfigurationException } from './exeptions'
@Injectable() @Injectable()
export class TelegrafBotService { export class TelegrafService {
private readonly logger = new Logger(TelegrafBotService.name, true) private readonly logger = new Logger(TelegrafService.name, true)
private readonly sitePublicUrl?: string private readonly sitePublicUrl?: string
private readonly bot: Telegraf<ContextMessageUpdate> private readonly bot: Telegraf<ContextMessageUpdate>
private ref: ModuleRef private ref: ModuleRef