mirror of
https://github.com/docmost/docmost.git
synced 2026-08-30 10:26:25 +08:00
refactor(base): rename baseId to pageId in BaseViewService
This commit is contained in:
@@ -42,7 +42,7 @@ export class BaseViewService {
|
|||||||
const position = generateJitteredKeyBetween(lastPosition, null);
|
const position = generateJitteredKeyBetween(lastPosition, null);
|
||||||
|
|
||||||
const created = await this.baseViewRepo.insertView({
|
const created = await this.baseViewRepo.insertView({
|
||||||
baseId: dto.baseId,
|
pageId: dto.baseId,
|
||||||
name: dto.name,
|
name: dto.name,
|
||||||
type: dto.type ?? 'table',
|
type: dto.type ?? 'table',
|
||||||
position,
|
position,
|
||||||
@@ -69,7 +69,7 @@ export class BaseViewService {
|
|||||||
throw new NotFoundException('View not found');
|
throw new NotFoundException('View not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view.baseId !== dto.baseId) {
|
if (view.pageId !== dto.baseId) {
|
||||||
throw new BadRequestException('View does not belong to this base');
|
throw new BadRequestException('View does not belong to this base');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,11 +119,11 @@ export class BaseViewService {
|
|||||||
throw new NotFoundException('View not found');
|
throw new NotFoundException('View not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view.baseId !== dto.baseId) {
|
if (view.pageId !== dto.baseId) {
|
||||||
throw new BadRequestException('View does not belong to this base');
|
throw new BadRequestException('View does not belong to this base');
|
||||||
}
|
}
|
||||||
|
|
||||||
const viewCount = await this.baseViewRepo.countByBaseId(dto.baseId, {
|
const viewCount = await this.baseViewRepo.countByPageId(dto.baseId, {
|
||||||
workspaceId,
|
workspaceId,
|
||||||
});
|
});
|
||||||
if (viewCount <= 1) {
|
if (viewCount <= 1) {
|
||||||
@@ -142,7 +142,7 @@ export class BaseViewService {
|
|||||||
this.eventEmitter.emit(EventName.BASE_VIEW_DELETED, event);
|
this.eventEmitter.emit(EventName.BASE_VIEW_DELETED, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
async listByBaseId(baseId: string, workspaceId: string) {
|
async listByBaseId(pageId: string, workspaceId: string) {
|
||||||
return this.baseViewRepo.findByBaseId(baseId, { workspaceId });
|
return this.baseViewRepo.findByPageId(pageId, { workspaceId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user