Merge pull request #402 from Hexastack/401-issue-missing-attached-entities
Some checks are pending
Build and Push Docker Images / paths-filter (push) Waiting to run
Build and Push Docker Images / build-and-push (push) Blocked by required conditions

fix: attach botStats and nlpSampleEnitity to the lifecyclehook
This commit is contained in:
Med Marrouchi 2024-12-04 17:01:02 +01:00 committed by GitHub
commit 85b696bebc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

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

View File

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