Преглед изворни кода

fixed missing schema error

ryosei-f пре 6 месеци
родитељ
комит
7d40fbe1f8
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      apps/app/src/server/service/growi-info/growi-info.ts

+ 1 - 1
apps/app/src/server/service/growi-info/growi-info.ts

@@ -118,7 +118,6 @@ export class GrowiInfoService {
 
 
   private async getAdditionalInfoByOptions<T extends GrowiInfoOptions>(options: T): Promise<IGrowiAdditionalInfoResult<T>> {
   private async getAdditionalInfoByOptions<T extends GrowiInfoOptions>(options: T): Promise<IGrowiAdditionalInfoResult<T>> {
     const User = mongoose.model<IUser, Model<IUser>>('User');
     const User = mongoose.model<IUser, Model<IUser>>('User');
-    const Page = mongoose.model<PageDocument, PageModel>('Page');
     // Check if any option is enabled to determine if we should return additional info
     // Check if any option is enabled to determine if we should return additional info
     const hasAnyOption = options.includeAttachmentInfo || options.includeInstalledInfo || options.includeUserCountInfo || options.includePageCountInfo;
     const hasAnyOption = options.includeAttachmentInfo || options.includeInstalledInfo || options.includeUserCountInfo || options.includePageCountInfo;
 
 
@@ -167,6 +166,7 @@ export class GrowiInfoService {
     }
     }
 
 
     if (options.includePageCountInfo) {
     if (options.includePageCountInfo) {
+      const Page = mongoose.model<PageDocument, PageModel>('Page');
       const currentPagesCount = await Page.countDocuments();
       const currentPagesCount = await Page.countDocuments();
       partialResult.currentPagesCount = currentPagesCount;
       partialResult.currentPagesCount = currentPagesCount;
     }
     }