feat(base): add POST /bases/rows/delete-many endpoint

This commit is contained in:
Philipinho
2026-04-18 16:31:44 +01:00
parent a7f9d66778
commit fc734475df
@@ -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(