add: commission setting
This commit is contained in:
@@ -11,13 +11,17 @@ import {
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { RoleService } from './roles.service';
|
||||
import { CommissionService } from './commission.service';
|
||||
|
||||
@Controller({
|
||||
path: 'config',
|
||||
version: '1',
|
||||
})
|
||||
export class ConfigurableController {
|
||||
constructor(private readonly roleService: RoleService) {}
|
||||
constructor(
|
||||
private readonly roleService: RoleService,
|
||||
private readonly commissionService: CommissionService,
|
||||
) {}
|
||||
|
||||
@Get('/roles')
|
||||
async findAll(@Query('page') page: number) {
|
||||
@@ -31,6 +35,18 @@ export class ConfigurableController {
|
||||
};
|
||||
}
|
||||
|
||||
@Get('/commission')
|
||||
async findCommission(@Query('page') page: number) {
|
||||
const [data, count] = await this.commissionService.findAllRoles(page);
|
||||
|
||||
return {
|
||||
data,
|
||||
count,
|
||||
statusCode: HttpStatus.OK,
|
||||
message: 'success',
|
||||
};
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async findOne(@Param('id', ParseUUIDPipe) id: string) {
|
||||
return {
|
||||
@@ -39,4 +55,16 @@ export class ConfigurableController {
|
||||
message: 'success',
|
||||
};
|
||||
}
|
||||
|
||||
@Put('/commission/:id')
|
||||
async updateCommission(
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Body() request,
|
||||
) {
|
||||
return {
|
||||
data: await this.commissionService.updateCommission(id, request),
|
||||
statusCode: HttpStatus.OK,
|
||||
message: 'success',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user