mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge pull request #852 from Hexastack/851-issue---make-logger-part-of-the-base-repository
feat: centrelize logger
This commit is contained in:
@@ -23,7 +23,6 @@ import {
|
||||
import { CsrfCheck } from '@tekuconcept/nestjs-csrf';
|
||||
|
||||
import { CsrfInterceptor } from '@/interceptors/csrf.interceptor';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseBlockPlugin } from '@/plugins/base-block-plugin';
|
||||
import { PluginService } from '@/plugins/plugins.service';
|
||||
import { PluginName, PluginType } from '@/plugins/types';
|
||||
@@ -57,7 +56,6 @@ export class BlockController extends BaseController<
|
||||
> {
|
||||
constructor(
|
||||
private readonly blockService: BlockService,
|
||||
private readonly logger: LoggerService,
|
||||
private readonly categoryService: CategoryService,
|
||||
private readonly labelService: LabelService,
|
||||
private readonly userService: UserService,
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
import { CsrfCheck } from '@tekuconcept/nestjs-csrf';
|
||||
|
||||
import { CsrfInterceptor } from '@/interceptors/csrf.interceptor';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseController } from '@/utils/generics/base-controller';
|
||||
import { DeleteResult } from '@/utils/generics/base-repository';
|
||||
import { PageQueryDto } from '@/utils/pagination/pagination-query.dto';
|
||||
@@ -38,10 +37,7 @@ import { CategoryService } from '../services/category.service';
|
||||
@UseInterceptors(CsrfInterceptor)
|
||||
@Controller('category')
|
||||
export class CategoryController extends BaseController<Category> {
|
||||
constructor(
|
||||
private readonly categoryService: CategoryService,
|
||||
private readonly logger: LoggerService,
|
||||
) {
|
||||
constructor(private readonly categoryService: CategoryService) {
|
||||
super(categoryService);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
import { CsrfCheck } from '@tekuconcept/nestjs-csrf';
|
||||
|
||||
import { CsrfInterceptor } from '@/interceptors/csrf.interceptor';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseController } from '@/utils/generics/base-controller';
|
||||
import { DeleteResult } from '@/utils/generics/base-repository';
|
||||
import { PageQueryDto } from '@/utils/pagination/pagination-query.dto';
|
||||
@@ -41,10 +40,7 @@ import { ContextVarService } from '../services/context-var.service';
|
||||
@UseInterceptors(CsrfInterceptor)
|
||||
@Controller('contextvar')
|
||||
export class ContextVarController extends BaseController<ContextVar> {
|
||||
constructor(
|
||||
private readonly contextVarService: ContextVarService,
|
||||
private readonly logger: LoggerService,
|
||||
) {
|
||||
constructor(private readonly contextVarService: ContextVarService) {
|
||||
super(contextVarService);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
import { CsrfCheck } from '@tekuconcept/nestjs-csrf';
|
||||
|
||||
import { CsrfInterceptor } from '@/interceptors/csrf.interceptor';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseController } from '@/utils/generics/base-controller';
|
||||
import { DeleteResult } from '@/utils/generics/base-repository';
|
||||
import { PageQueryDto } from '@/utils/pagination/pagination-query.dto';
|
||||
@@ -49,10 +48,7 @@ export class LabelController extends BaseController<
|
||||
LabelPopulate,
|
||||
LabelFull
|
||||
> {
|
||||
constructor(
|
||||
private readonly labelService: LabelService,
|
||||
private readonly logger: LoggerService,
|
||||
) {
|
||||
constructor(private readonly labelService: LabelService) {
|
||||
super(labelService);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import { Request } from 'express'; // Import the Express request and response ty
|
||||
import { ChannelService } from '@/channel/channel.service';
|
||||
import { GenericEventWrapper } from '@/channel/lib/EventWrapper';
|
||||
import { CsrfInterceptor } from '@/interceptors/csrf.interceptor';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseController } from '@/utils/generics/base-controller';
|
||||
import { BaseSchema } from '@/utils/generics/base-schema';
|
||||
import { PageQueryDto } from '@/utils/pagination/pagination-query.dto';
|
||||
@@ -64,7 +63,6 @@ export class MessageController extends BaseController<
|
||||
private readonly messageService: MessageService,
|
||||
private readonly subscriberService: SubscriberService,
|
||||
private readonly channelService: ChannelService,
|
||||
private readonly logger: LoggerService,
|
||||
) {
|
||||
super(messageService);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import { CsrfCheck } from '@tekuconcept/nestjs-csrf';
|
||||
|
||||
import { AttachmentService } from '@/attachment/services/attachment.service';
|
||||
import { CsrfInterceptor } from '@/interceptors/csrf.interceptor';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseController } from '@/utils/generics/base-controller';
|
||||
import { generateInitialsAvatar } from '@/utils/helpers/avatar';
|
||||
import { PageQueryDto } from '@/utils/pagination/pagination-query.dto';
|
||||
@@ -50,7 +49,6 @@ export class SubscriberController extends BaseController<
|
||||
constructor(
|
||||
private readonly subscriberService: SubscriberService,
|
||||
private readonly attachmentService: AttachmentService,
|
||||
private readonly logger: LoggerService,
|
||||
) {
|
||||
super(subscriberService);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||
*/
|
||||
|
||||
import { Injectable, Optional } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { InjectModel } from '@nestjs/mongoose';
|
||||
import {
|
||||
Document,
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
UpdateWithAggregationPipeline,
|
||||
} from 'mongoose';
|
||||
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseRepository, DeleteResult } from '@/utils/generics/base-repository';
|
||||
import { TFilterQuery } from '@/utils/types/filter.types';
|
||||
|
||||
@@ -36,10 +35,7 @@ export class BlockRepository extends BaseRepository<
|
||||
BlockFull,
|
||||
BlockDto
|
||||
> {
|
||||
constructor(
|
||||
@InjectModel(Block.name) readonly model: Model<Block>,
|
||||
@Optional() private readonly logger?: LoggerService,
|
||||
) {
|
||||
constructor(@InjectModel(Block.name) readonly model: Model<Block>) {
|
||||
super(model, Block, BLOCK_POPULATE, BlockFull);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import { CONSOLE_CHANNEL_NAME } from '@/extensions/channels/console/settings';
|
||||
import { NLU } from '@/helper/types';
|
||||
import { I18nService } from '@/i18n/services/i18n.service';
|
||||
import { LanguageService } from '@/i18n/services/language.service';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { PluginService } from '@/plugins/plugins.service';
|
||||
import { PluginType } from '@/plugins/types';
|
||||
import { SettingService } from '@/setting/services/setting.service';
|
||||
@@ -52,7 +51,6 @@ export class BlockService extends BaseService<
|
||||
private readonly contentService: ContentService,
|
||||
private readonly settingService: SettingService,
|
||||
private readonly pluginService: PluginService,
|
||||
private readonly logger: LoggerService,
|
||||
protected readonly i18n: I18nService,
|
||||
protected readonly languageService: LanguageService,
|
||||
) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
|
||||
import EventWrapper from '@/channel/lib/EventWrapper';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseService } from '@/utils/generics/base-service';
|
||||
|
||||
import { ConversationDto } from '../dto/conversation.dto';
|
||||
@@ -36,7 +35,6 @@ export class ConversationService extends BaseService<
|
||||
> {
|
||||
constructor(
|
||||
readonly repository: ConversationRepository,
|
||||
private readonly logger: LoggerService,
|
||||
private readonly contextVarService: ContextVarService,
|
||||
private readonly subscriberService: SubscriberService,
|
||||
) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
Optional,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseService } from '@/utils/generics/base-service';
|
||||
import {
|
||||
SocketGet,
|
||||
@@ -36,17 +35,13 @@ export class MessageService extends BaseService<
|
||||
MessagePopulate,
|
||||
MessageFull
|
||||
> {
|
||||
private readonly logger: LoggerService;
|
||||
|
||||
private readonly gateway: WebsocketGateway;
|
||||
|
||||
constructor(
|
||||
private readonly messageRepository: MessageRepository,
|
||||
@Optional() logger?: LoggerService,
|
||||
@Optional() gateway?: WebsocketGateway,
|
||||
) {
|
||||
super(messageRepository);
|
||||
if (logger) this.logger = logger;
|
||||
if (gateway) this.gateway = gateway;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import { OnEvent } from '@nestjs/event-emitter';
|
||||
|
||||
import { AttachmentService } from '@/attachment/services/attachment.service';
|
||||
import { config } from '@/config';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { BaseService } from '@/utils/generics/base-service';
|
||||
import {
|
||||
SocketGet,
|
||||
@@ -48,7 +47,6 @@ export class SubscriberService extends BaseService<
|
||||
|
||||
constructor(
|
||||
readonly repository: SubscriberRepository,
|
||||
private readonly logger: LoggerService,
|
||||
protected attachmentService: AttachmentService,
|
||||
@Optional() gateway?: WebsocketGateway,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user