fix: attach botStats and nlpSampleEnity to the lifecyclehook

This commit is contained in:
yassinedorbozgithub 2024-12-04 09:00:50 +01:00
parent acf3663bd5
commit a81f3f0c5a
2 changed files with 9 additions and 6 deletions

View File

@ -9,6 +9,7 @@
import { ModelDefinition, Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { BaseSchema } from '@/utils/generics/base-schema';
import { LifecycleHookManager } from '@/utils/generics/lifecycle-hook-manager';
import { THydratedDocument } from '@/utils/types/filter.types';
export enum BotStatsType {
@ -115,9 +116,9 @@ export class BotStats extends BaseSchema {
export type BotStatsDocument = THydratedDocument<BotStats>;
export const BotStatsModel: ModelDefinition = {
export const BotStatsModel: ModelDefinition = LifecycleHookManager.attach({
name: BotStats.name,
schema: SchemaFactory.createForClass(BotStats),
};
});
export default BotStatsModel.schema;

View File

@ -11,6 +11,7 @@ import { Transform, Type } from 'class-transformer';
import { Schema as MongooseSchema } from 'mongoose';
import { BaseSchema } from '@/utils/generics/base-schema';
import { LifecycleHookManager } from '@/utils/generics/lifecycle-hook-manager';
import {
TFilterPopulateFields,
THydratedDocument,
@ -103,10 +104,11 @@ export class NlpSampleEntityFull extends NlpSampleEntityStub {
export type NlpSampleEntityDocument = THydratedDocument<NlpSampleEntity>;
export const NlpSampleEntityModel: ModelDefinition = {
name: NlpSampleEntity.name,
schema: SchemaFactory.createForClass(NlpSampleEntityStub),
};
export const NlpSampleEntityModel: ModelDefinition =
LifecycleHookManager.attach({
name: NlpSampleEntity.name,
schema: SchemaFactory.createForClass(NlpSampleEntityStub),
});
export default NlpSampleEntityModel.schema;