mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
feat(base): add POST /bases/rows/delete-many endpoint
This commit is contained in:
@@ -14,6 +14,7 @@ import { CreateRowDto } from '../dto/create-row.dto';
|
|||||||
import {
|
import {
|
||||||
UpdateRowDto,
|
UpdateRowDto,
|
||||||
DeleteRowDto,
|
DeleteRowDto,
|
||||||
|
DeleteRowsDto,
|
||||||
RowIdDto,
|
RowIdDto,
|
||||||
ListRowsDto,
|
ListRowsDto,
|
||||||
ReorderRowDto,
|
ReorderRowDto,
|
||||||
@@ -118,6 +119,26 @@ export class BaseRowController {
|
|||||||
await this.baseRowService.delete(dto, workspace.id, user.id);
|
await this.baseRowService.delete(dto, workspace.id, user.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@HttpCode(HttpStatus.OK)
|
||||||
|
@Post('delete-many')
|
||||||
|
async deleteMany(
|
||||||
|
@Body() dto: DeleteRowsDto,
|
||||||
|
@AuthUser() user: User,
|
||||||
|
@AuthWorkspace() workspace: Workspace,
|
||||||
|
) {
|
||||||
|
const base = await this.baseRepo.findById(dto.baseId);
|
||||||
|
if (!base) {
|
||||||
|
throw new NotFoundException('Base not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
const ability = await this.spaceAbility.createForUser(user, base.spaceId);
|
||||||
|
if (ability.cannot(SpaceCaslAction.Edit, SpaceCaslSubject.Base)) {
|
||||||
|
throw new ForbiddenException();
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.baseRowService.deleteMany(dto, workspace.id, user.id);
|
||||||
|
}
|
||||||
|
|
||||||
@HttpCode(HttpStatus.OK)
|
@HttpCode(HttpStatus.OK)
|
||||||
@Post('list')
|
@Post('list')
|
||||||
async list(
|
async list(
|
||||||
|
|||||||
Reference in New Issue
Block a user