Skip to content

Commit

Permalink
fix(assignments-service): Improper validation and transformation of a…
Browse files Browse the repository at this point in the history
…rray bodies
  • Loading branch information
Clashsoft committed Nov 17, 2023
1 parent e2ef1ab commit a8ee22c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions services/apps/assignments/src/assignee/assignee.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {NotFound, ObjectIdPipe} from '@mean-stream/nestx';
import {Body, Controller, Delete, Get, Param, Patch, Put} from '@nestjs/common';
import {Body, Controller, Delete, Get, Param, ParseArrayPipe, Patch, Put} from '@nestjs/common';
import {ApiOkResponse, ApiOperation, ApiTags} from '@nestjs/swagger';
import {AssignmentAuth} from '../assignment/assignment-auth.decorator';
import {BulkUpdateAssigneeDto, PatchAssigneeDto, UpdateAssigneeDto} from './assignee.dto';
Expand Down Expand Up @@ -42,7 +42,7 @@ export class AssigneeController {
@ApiOkResponse({type: Assignee})
async updateMany(
@Param('assignment', ObjectIdPipe) assignment: Types.ObjectId,
@Body() dtos: BulkUpdateAssigneeDto[],
@Body(new ParseArrayPipe({ items: BulkUpdateAssigneeDto })) dtos: BulkUpdateAssigneeDto[],
): Promise<Assignee[]> {
return this.assigneeService.upsertMany(assignment, dtos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class SolutionController {
@ApiOkResponse({type: [Solution]})
async updateMany(
@Param('assignment', ObjectIdPipe) assignment: Types.ObjectId,
@Body() dtos: BatchUpdateSolutionDto[],
@Body(new ParseArrayPipe({items: BatchUpdateSolutionDto })) dtos: BatchUpdateSolutionDto[],
): Promise<(Solution | null)[]> {
return this.solutionService.batchUpdate(assignment, dtos);
}
Expand Down

0 comments on commit a8ee22c

Please sign in to comment.