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!

take/skip params min/max validation

Blue Mousea75195028849
diff --git a/backend/apps/cloud/src/analytics/dto/get-errors.dto.ts b/backend/apps/cloud/src/analytics/dto/get-errors.dto.ts
index cca8eb630..202912d1c 100644
--- a/backend/apps/cloud/src/analytics/dto/get-errors.dto.ts
+++ b/backend/apps/cloud/src/analytics/dto/get-errors.dto.ts
@@ -1,5 +1,6 @@
import { PickType, ApiProperty } from '@nestjs/swagger'
import { Type } from 'class-transformer'
+import { IsInt, Min } from 'class-validator'
import { GetDataDto } from './getData.dto'
export class GetErrorsDto extends PickType(GetDataDto, [
@@ -11,9 +12,13 @@ export class GetErrorsDto extends PickType(GetDataDto, [
'timezone',
] as const) {
@Type(() => Number)
+ @IsInt()
+ @Min(0)
take: number
@Type(() => Number)
+ @IsInt()
+ @Min(0)
skip: number
@ApiProperty({
diff --git a/backend/apps/cloud/src/analytics/dto/get-profile.dto.ts b/backend/apps/cloud/src/analytics/dto/get-profile.dto.ts
index 8cb25d48c..6579fa9f5 100644
--- a/backend/apps/cloud/src/analytics/dto/get-profile.dto.ts
+++ b/backend/apps/cloud/src/analytics/dto/get-profile.dto.ts
@@ -1,6 +1,6 @@
import { ApiProperty, PickType } from '@nestjs/swagger'
import { Type } from 'class-transformer'
-import { IsNotEmpty, IsOptional, Matches } from 'class-validator'
+import { IsNotEmpty, IsOptional, Matches, IsInt, Min } from 'class-validator'
import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'
import { PID_REGEX } from '../../common/constants'
import { ValidatePeriod } from '../decorators/validate-period.decorator'
@@ -60,10 +60,14 @@ export class GetProfileSessionsDto extends PickType(GetDataDto, [
@ApiProperty({ required: false, default: 30 })
@IsOptional()
@Type(() => Number)
+ @IsInt()
+ @Min(0)
take?: number
@ApiProperty({ required: false, default: 0 })
@IsOptional()
@Type(() => Number)
+ @IsInt()
+ @Min(0)
skip?: number
}
diff --git a/backend/apps/cloud/src/analytics/dto/get-profiles.dto.ts b/backend/apps/cloud/src/analytics/dto/get-profiles.dto.ts
index e78f72dcc..eeae7de3b 100644
--- a/backend/apps/cloud/src/analytics/dto/get-profiles.dto.ts
+++ b/backend/apps/cloud/src/analytics/dto/get-profiles.dto.ts
@@ -1,6 +1,6 @@
import { ApiProperty, PickType } from '@nestjs/swagger'
import { Type } from 'class-transformer'
-import { IsOptional, IsIn } from 'class-validator'
+import { IsOptional, IsIn, IsInt, Min } from 'class-validator'
import { GetDataDto } from './getData.dto'
export class GetProfilesDto extends PickType(GetDataDto, [
@@ -14,11 +14,15 @@ export class GetProfilesDto extends PickType(GetDataDto, [
@ApiProperty({ required: false, default: 30 })
@IsOptional()
@Type(() => Number)
+ @IsInt()
+ @Min(0)
take?: number
@ApiProperty({ required: false, default: 0 })
@IsOptional()
@Type(() => Number)
+ @IsInt()
+ @Min(0)
skip?: number
@ApiProperty({
diff --git a/backend/apps/cloud/src/analytics/dto/get-sessions.dto.ts b/backend/apps/cloud/src/analytics/dto/get-sessions.dto.ts
index bf369cc7c..c2afe3c3a 100644
--- a/backend/apps/cloud/src/analytics/dto/get-sessions.dto.ts
+++ b/backend/apps/cloud/src/analytics/dto/get-sessions.dto.ts
@@ -1,5 +1,6 @@
import { PickType } from '@nestjs/swagger'
import { Type } from 'class-transformer'
+import { IsInt, Min } from 'class-validator'
import { GetDataDto } from './getData.dto'
export class GetSessionsDto extends PickType(GetDataDto, [
@@ -11,8 +12,12 @@ export class GetSessionsDto extends PickType(GetDataDto, [
'timezone',
] as const) {
@Type(() => Number)
+ @IsInt()
+ @Min(0)
take: number
@Type(() => Number)
+ @IsInt()
+ @Min(0)
skip: number
}
diff --git a/backend/apps/community/src/analytics/dto/get-errors.dto.ts b/backend/apps/community/src/analytics/dto/get-errors.dto.ts
index cca8eb630..202912d1c 100644
--- a/backend/apps/community/src/analytics/dto/get-errors.dto.ts
+++ b/backend/apps/community/src/analytics/dto/get-errors.dto.ts
@@ -1,5 +1,6 @@
import { PickType, ApiProperty } from '@nestjs/swagger'
import { Type } from 'class-transformer'
+import { IsInt, Min } from 'class-validator'
import { GetDataDto } from './getData.dto'
export class GetErrorsDto extends PickType(GetDataDto, [
@@ -11,9 +12,13 @@ export class GetErrorsDto extends PickType(GetDataDto, [
'timezone',
] as const) {
@Type(() => Number)
+ @IsInt()
+ @Min(0)
take: number
@Type(() => Number)
+ @IsInt()
+ @Min(0)
skip: number
@ApiProperty({
diff --git a/backend/apps/community/src/analytics/dto/get-sessions.dto.ts b/backend/apps/community/src/analytics/dto/get-sessions.dto.ts
index bf369cc7c..c2afe3c3a 100644
--- a/backend/apps/community/src/analytics/dto/get-sessions.dto.ts
+++ b/backend/apps/community/src/analytics/dto/get-sessions.dto.ts
@@ -1,5 +1,6 @@
import { PickType } from '@nestjs/swagger'
import { Type } from 'class-transformer'
+import { IsInt, Min } from 'class-validator'
import { GetDataDto } from './getData.dto'
export class GetSessionsDto extends PickType(GetDataDto, [
@@ -11,8 +12,12 @@ export class GetSessionsDto extends PickType(GetDataDto, [
'timezone',
] as const) {
@Type(() => Number)
+ @IsInt()
+ @Min(0)
take: number
@Type(() => Number)
+ @IsInt()
+ @Min(0)
skip: number
}