Skip to content

Commit

Permalink
Fix back endpoint bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahdigh committed Aug 1, 2024
1 parent bd4b21f commit 79324ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/flow/dto/bodies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export class DnDBody {

export class RemoveLastVoteDto {
@ApiProperty({
type: 'number',
description:
'Collection id (skip for the top-level collection comparisons)',
'Collection id (null for the top-level collection comparisons)',
})
@IsOptional()
collectionId?: number;
@IsDefined()
collectionId: number | null;
}
5 changes: 3 additions & 2 deletions src/flow/flow.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ export class FlowController {
@Post('/pairs/back')
async removeLastVote(
@Req() { userId }: AuthedReq,
@Body('cid') { collectionId }: RemoveLastVoteDto,
@Body() { collectionId }: RemoveLastVoteDto,
) {
if (!collectionId) return this.flowService.removeLastVote(userId, null);
if (collectionId === null)
return this.flowService.removeLastVote(userId, null);

const progressStatus = await this.flowService.getCollectionProgressStatus(
userId,
Expand Down

0 comments on commit 79324ae

Please sign in to comment.