fix(server): 路由 id 使用 ParseIntPipe,限制分页与批量数组上限
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Query,
|
||||
UseGuards,
|
||||
Request,
|
||||
@@ -42,7 +43,7 @@ export class OrganizationsController {
|
||||
|
||||
@Get(':id')
|
||||
@RequirePermission('organization:view')
|
||||
findOne(@Param('id') id: string) {
|
||||
findOne(@Param('id', ParseIntPipe) id: number) {
|
||||
return this.service.findOne(+id);
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@ export class OrganizationsController {
|
||||
|
||||
@Put(':id')
|
||||
@RequirePermission('organization:edit')
|
||||
async update(@Param('id') id: string, @Body() dto: UpdateOrganizationDto, @Request() req: any) {
|
||||
async update(@Param('id', ParseIntPipe) id: number, @Body() dto: UpdateOrganizationDto, @Request() req: any) {
|
||||
const { ipAddress, userAgent } = extractRequestInfo(req);
|
||||
const result = await this.service.update(+id, dto);
|
||||
await this.logService.log({
|
||||
@@ -86,7 +87,7 @@ export class OrganizationsController {
|
||||
|
||||
@Delete(':id')
|
||||
@RequirePermission('organization:delete')
|
||||
async remove(@Param('id') id: string, @Request() req: any) {
|
||||
async remove(@Param('id', ParseIntPipe) id: number, @Request() req: any) {
|
||||
const { ipAddress, userAgent } = extractRequestInfo(req);
|
||||
const result = await this.service.remove(+id);
|
||||
await this.logService.log({
|
||||
@@ -104,7 +105,7 @@ export class OrganizationsController {
|
||||
|
||||
@Delete(':id/permanent')
|
||||
@RequirePermission('organization:purge')
|
||||
async purge(@Param('id') id: string, @Request() req: any) {
|
||||
async purge(@Param('id', ParseIntPipe) id: number, @Request() req: any) {
|
||||
const { ipAddress, userAgent } = extractRequestInfo(req);
|
||||
const result = await this.service.purge(+id);
|
||||
await this.logService.log({
|
||||
|
||||
Reference in New Issue
Block a user