From ec99dcd65feb1dbd50161eebc07d1c3b204f0d19 Mon Sep 17 00:00:00 2001 From: Aleksandr Bukhalo Date: Sun, 12 Jan 2020 10:53:45 +0300 Subject: [PATCH] refactor(services): rename module services --- lib/exeptions/index.ts | 2 +- lib/index.ts | 4 ++-- ...ent.service.ts => telegraf-telegram.service.ts} | 2 +- lib/telegraf.module.ts | 14 +++++--------- ...telegraf-bot.service.ts => telegraf.service.ts} | 4 ++-- 5 files changed, 11 insertions(+), 15 deletions(-) rename lib/{telegraf-telegram-client.service.ts => telegraf-telegram.service.ts} (94%) rename lib/{telegraf-bot.service.ts => telegraf.service.ts} (97%) diff --git a/lib/exeptions/index.ts b/lib/exeptions/index.ts index 4ab02f7..40f3902 100644 --- a/lib/exeptions/index.ts +++ b/lib/exeptions/index.ts @@ -1 +1 @@ -export * from './invalid-configuration.exeption'; +export * from './invalid-configuration.exeption' diff --git a/lib/index.ts b/lib/index.ts index 37afd79..d7b43b6 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,5 +1,5 @@ export * from './telegraf.module' export * from './interfaces' export * from './decorators' -export * from './telegraf-bot.service' -export * from './telegraf-telegram-client.service' +export * from './telegraf.service' +export * from './telegraf-telegram.service' diff --git a/lib/telegraf-telegram-client.service.ts b/lib/telegraf-telegram.service.ts similarity index 94% rename from lib/telegraf-telegram-client.service.ts rename to lib/telegraf-telegram.service.ts index 251689c..5b672d7 100644 --- a/lib/telegraf-telegram-client.service.ts +++ b/lib/telegraf-telegram.service.ts @@ -5,7 +5,7 @@ import { TokenInjectionToken } from './telegraf.constants' import { TelegrafOptionsFactory } from './interfaces' @Injectable() -export class TelegrafTelegramClientService { +export class TelegrafTelegramService { private telegram: any public constructor( diff --git a/lib/telegraf.module.ts b/lib/telegraf.module.ts index 366bbf9..e860b19 100644 --- a/lib/telegraf.module.ts +++ b/lib/telegraf.module.ts @@ -1,11 +1,7 @@ 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 { TelegrafTelegramClientService } from './telegraf-telegram-client.service' +import { TelegrafService, TelegrafTelegramService } from './' @Module({}) export class TelegrafModule { @@ -15,14 +11,14 @@ export class TelegrafModule { imports: options.imports || [], providers: [ ...this.createAsyncProviders(options), - TelegrafBotService, - TelegrafTelegramClientService, + TelegrafService, + TelegrafTelegramService, { provide: TokenInjectionToken, useClass: options.useClass, }, ], - exports: [TelegrafBotService, TelegrafTelegramClientService], + exports: [TelegrafService, TelegrafTelegramService], } } diff --git a/lib/telegraf-bot.service.ts b/lib/telegraf.service.ts similarity index 97% rename from lib/telegraf-bot.service.ts rename to lib/telegraf.service.ts index 68af500..9200c0d 100644 --- a/lib/telegraf-bot.service.ts +++ b/lib/telegraf.service.ts @@ -14,8 +14,8 @@ import { import { InvalidConfigurationException } from './exeptions' @Injectable() -export class TelegrafBotService { - private readonly logger = new Logger(TelegrafBotService.name, true) +export class TelegrafService { + private readonly logger = new Logger(TelegrafService.name, true) private readonly sitePublicUrl?: string private readonly bot: Telegraf private ref: ModuleRef