Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Fixed a problem with alerts

Yevhenii Kulisidi90dd220e146b
diff --git a/src/alert/dto/alert.dto.ts b/src/alert/dto/alert.dto.ts
index 1574d266c..b0e4b6ef1 100644
--- a/src/alert/dto/alert.dto.ts
+++ b/src/alert/dto/alert.dto.ts
@@ -1,4 +1,5 @@
import { ApiProperty } from '@nestjs/swagger'
+import { IsNotEmpty, IsOptional } from 'class-validator'
export enum QueryMetric {
PAGE_VIEWS = 'page_views',
@@ -24,37 +25,48 @@ export enum QueryTime {
export class AlertDTO {
@ApiProperty()
- queryMetric?: QueryMetric | null
+ @IsOptional()
+ queryMetric?: QueryMetric
@ApiProperty()
- queryCondition?: QueryCondition | null
+ @IsOptional()
+ queryCondition?: QueryCondition
@ApiProperty()
- queryValue?: number | null
+ @IsOptional()
+ queryValue?: number
@ApiProperty()
- queryTime?: QueryTime | null
+ @IsOptional()
+ queryTime?: QueryTime
@ApiProperty()
+ @IsOptional()
active?: boolean
}
export class CreateAlertDTO {
@ApiProperty()
+ @IsNotEmpty()
pid: string
@ApiProperty()
+ @IsNotEmpty()
name: string
@ApiProperty()
- queryMetric: QueryMetric | null
+ @IsOptional()
+ queryMetric?: QueryMetric
@ApiProperty()
- queryCondition: QueryCondition | null
+ @IsOptional()
+ queryCondition?: QueryCondition
@ApiProperty()
- queryValue: number | null
+ @IsOptional()
+ queryValue?: number
@ApiProperty()
- queryTime: QueryTime | null
+ @IsOptional()
+ queryTime?: QueryTime
}
diff --git a/src/task-manager/task-manager.service.ts b/src/task-manager/task-manager.service.ts
index 8cbaca5a7..9aece3a4a 100644
--- a/src/task-manager/task-manager.service.ts
+++ b/src/task-manager/task-manager.service.ts
@@ -392,7 +392,7 @@ export class TaskManagerService {
active: true,
})
- for (let i = 0; i < _size(projects); ++i) {
+ for (let i = 0; i < _size(alerts); ++i) {
const alert = alerts[i]
const project = _find(projects, { id: alert.project.id })