All files / libs/reporting/dashboards-v2/api/src/lib/dtos patch-dashboard.dto.ts

100% Statements 61/61
100% Branches 0/0
100% Functions 0/0
100% Lines 61/61

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 621x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsBoolean, IsOptional, IsString, ValidateNested } from 'class-validator';
 
import { ChartLayoutConfig, DashboardFilters, PatchDashboardRequest } from '@amalia/reporting/dashboards-v2/types';
 
class DashboardFilterGroupDto {
  @ApiProperty()
  @IsBoolean()
  public readonly isEnabled!: boolean;
 
  @ApiProperty()
  @IsArray()
  @IsString({ each: true })
  public readonly values!: string[];
}
 
class DashboardFiltersDto implements DashboardFilters {
  @ApiProperty()
  @ValidateNested()
  @Type(() => DashboardFilterGroupDto)
  public readonly periods!: DashboardFilterGroupDto;
 
  @ApiProperty()
  @ValidateNested()
  @Type(() => DashboardFilterGroupDto)
  public readonly plans!: DashboardFilterGroupDto;
 
  @ApiProperty()
  @ValidateNested()
  @Type(() => DashboardFilterGroupDto)
  public readonly teams!: DashboardFilterGroupDto;
 
  @ApiProperty()
  @ValidateNested()
  @Type(() => DashboardFilterGroupDto)
  public readonly users!: DashboardFilterGroupDto;
}
 
export class PatchDashboardDto implements PatchDashboardRequest {
  @ApiProperty()
  @IsOptional()
  @IsString()
  public readonly name?: string;
 
  @ApiProperty()
  @IsOptional()
  @IsArray()
  public readonly chartsLayoutConfig?: ChartLayoutConfig[];
 
  @ApiProperty()
  @IsOptional()
  @ValidateNested()
  @Type(() => DashboardFiltersDto)
  public readonly filters?: DashboardFiltersDto;
 
  @ApiProperty()
  @IsOptional()
  @IsBoolean()
  public readonly isPrivate?: boolean;
}