Skip to content

Commit

Permalink
Fix/nullable team (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForsbergPhilip authored Nov 15, 2024
1 parent cd689c4 commit 781fdf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/backend/src/models/highscore-public.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IHighscoreDto } from "@etimo/diamonds2-types";
import { ApiProperty } from "@nestjs/swagger";
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsOptional } from "class-validator";
import { IHighscore } from "../types";

export class HighscorePublicDto implements IHighscoreDto {
Expand All @@ -12,8 +13,9 @@ export class HighscorePublicDto implements IHighscoreDto {
@ApiProperty()
seasonId!: string;

@ApiProperty()
team!: string;
@ApiPropertyOptional({ nullable: true })
@IsOptional()
team: string | null = null;

@ApiProperty()
teamLogotype!: string;
Expand All @@ -23,7 +25,7 @@ export class HighscorePublicDto implements IHighscoreDto {
botName: entity.bot!.name,
score: entity.score,
seasonId: entity.seasonId,
team: entity.bot!.team!.name,
team: entity.bot!.team?.name ?? null,
teamLogotype: entity.bot!.team!.logotypeUrl,
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/dto/highscore-dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export interface IHighscoreDto {
botName: string;
score: number;
seasonId: string;
team: string;
team: string | null;
teamLogotype: string;
}

0 comments on commit 781fdf9

Please sign in to comment.