feat(base): create() now allocates an is_base=true page via PageService

This commit is contained in:
Philipinho
2026-04-27 01:16:48 +01:00
parent ccdf2343f2
commit a2917bad6d
5 changed files with 45 additions and 31 deletions
@@ -1,4 +1,5 @@
import {
IsBoolean,
IsIn,
IsOptional,
IsString,
@@ -25,6 +26,10 @@ export class CreatePageDto {
@IsUUID()
spaceId: string;
@IsOptional()
@IsBoolean()
isBase?: boolean;
@IsOptional()
content?: string | object;
@@ -15,7 +15,7 @@ import {
executeWithCursorPagination,
} from '@docmost/db/pagination/cursor-pagination';
import { InjectKysely } from 'nestjs-kysely';
import { KyselyDB } from '@docmost/db/types/kysely.types';
import { KyselyDB, KyselyTransaction } from '@docmost/db/types/kysely.types';
import { generateJitteredKeyBetween } from 'fractional-indexing-jittered';
import { MovePageDto } from '../dto/move-page.dto';
import { generateSlugId } from '../../../common/helpers';
@@ -90,6 +90,7 @@ export class PageService {
userId: string,
workspaceId: string,
createPageDto: CreatePageDto,
trx?: KyselyTransaction,
): Promise<Page> {
let parentPageId = undefined;
@@ -138,10 +139,11 @@ export class PageService {
creatorId: userId,
workspaceId: workspaceId,
lastUpdatedById: userId,
isBase: createPageDto.isBase ?? false,
content,
textContent,
ydoc,
});
}, trx);
this.generalQueue
.add(QueueJob.ADD_PAGE_WATCHERS, {