feat: create api to bulk update privileges
continuous-integration/drone/tag Build is passing Details

pull/74/head 20.1.47-alpha.1
shancheas 2024-08-21 17:06:20 +07:00
parent 84b829a7fa
commit 9815c667f0
1 changed files with 14 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Put, Query } from '@nestjs/common'; import { Body, Controller, Get, Put, Query } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { ExcludePrivilege, Public } from 'src/core/guards'; import { ExcludePrivilege, Public } from 'src/core/guards';
import { MODULE_NAME } from 'src/core/strings/constants/module.constants'; import { MODULE_NAME } from 'src/core/strings/constants/module.constants';
@ -28,6 +28,19 @@ export class UserPrivilegeConfigurationController {
return await this.orchestrator.update(data); return await this.orchestrator.update(data);
} }
@Put('/bulk')
async updateBulk(
@Body() datum: UserPrivilegeConfigurationDto[],
): Promise<UserPrivilegeConfigurationEntity[]> {
const results = [];
for (const data of datum) {
const result = await this.orchestrator.update(data);
results.push(result);
}
return results;
}
@Get() @Get()
@Pagination() @Pagination()
async index( async index(