|
|
@@ -88,16 +88,12 @@ export interface PageModel extends Model<PageDocument> {
|
|
|
findByIdsAndViewer(
|
|
|
pageIds: ObjectIdLike[], user, userGroups?, includeEmpty?: boolean, includeAnyoneWithTheLink?: boolean,
|
|
|
): Promise<HydratedDocument<PageDocument>[]>
|
|
|
- findByPathsAndViewer(
|
|
|
- paths: string[], user, userGroups?, includeEmpty?: boolean, includeAnyoneWithTheLink?: boolean,
|
|
|
- ): Promise<HydratedDocument<PageDocument>[]>
|
|
|
findByPath(path: string, includeEmpty?: boolean): Promise<HydratedDocument<PageDocument> | null>
|
|
|
findByPathAndViewer(path: string | null, user, userGroups?, useFindOne?: true, includeEmpty?: boolean): Promise<HydratedDocument<PageDocument> | null>
|
|
|
findByPathAndViewer(path: string | null, user, userGroups?, useFindOne?: false, includeEmpty?: boolean): Promise<HydratedDocument<PageDocument>[]>
|
|
|
descendantCountByPaths(
|
|
|
paths: string[], user, userGroups?, includeEmpty?: boolean, includeAnyoneWithTheLink?: boolean
|
|
|
): Promise<IPagePathWithDescendantCount[]>
|
|
|
- // countByPathAndViewer(path: string | null, user, userGroups?, includeEmpty?:boolean): Promise<number>
|
|
|
findParentByPath(path: string | null): Promise<HydratedDocument<PageDocument> | null>
|
|
|
findTargetAndAncestorsByPathOrId(pathOrId: string): Promise<TargetAndAncestorsResult>
|
|
|
findRecentUpdatedPages(path: string, user, option: FindRecentUpdatedPagesOption, includeEmpty?: boolean): Promise<PaginatedPages>
|
|
|
@@ -676,24 +672,6 @@ schema.statics.findByPathAndViewer = async function(
|
|
|
return queryBuilder.query.exec();
|
|
|
};
|
|
|
|
|
|
-/*
|
|
|
- * Find pages by paths and viewer.
|
|
|
- */
|
|
|
-schema.statics.findByPathsAndViewer = async function(
|
|
|
- paths: string[], user, userGroups = null, includeEmpty = false, includeAnyoneWithTheLink = false,
|
|
|
-): Promise<{path: string, descendantCount: number}[]> {
|
|
|
- if (paths.length === 0) {
|
|
|
- throw new Error('paths are required.');
|
|
|
- }
|
|
|
-
|
|
|
- const baseQuery = this.find({ path: { $in: paths } });
|
|
|
- const queryBuilder = new PageQueryBuilder(baseQuery, includeEmpty);
|
|
|
-
|
|
|
- await queryBuilder.addViewerCondition(user, userGroups, includeAnyoneWithTheLink);
|
|
|
-
|
|
|
- return queryBuilder.query.exec();
|
|
|
-};
|
|
|
-
|
|
|
schema.statics.descendantCountByPaths = async function(
|
|
|
paths: string[],
|
|
|
user,
|