📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Move timebucket validation to the DTO
Blue Mousec23015d915a0
diff --git a/backend/apps/production/src/analytics/analytics.controller.ts b/backend/apps/production/src/analytics/analytics.controller.tsindex 33ad5f578..ceac7520d 100644--- a/backend/apps/production/src/analytics/analytics.controller.ts+++ b/backend/apps/production/src/analytics/analytics.controller.ts@@ -46,12 +46,11 @@ import { DEFAULT_TIMEZONE } from '../user/entities/user.entity'import { RolesGuard } from '../auth/guards/roles.guard'import { PageviewsDTO } from './dto/pageviews.dto'import { EventsDTO } from './dto/events.dto'-import { AnalyticsGET_DTO, ChartRenderMode } from './dto/getData.dto'+import { GetDataDto, ChartRenderMode } from './dto/getData.dto'import { GetCustomEventMetadata } from './dto/get-custom-event-meta.dto'-import { GetPagePropertyMetaDTO } from './dto/get-page-property-meta.dto'+import { GetPagePropertyMetaDto } from './dto/get-page-property-meta.dto'import { GetUserFlowDTO } from './dto/getUserFlow.dto'import { GetFunnelsDTO } from './dto/getFunnels.dto'-import { ProjectService } from '../project/project.service'import { AppLoggerService } from '../logger/logger.service'import {redis,@@ -80,7 +79,7 @@ import { GetMonitorDataDto } from './dto/get-monitor-data.dto'import { GetSessionDto } from './dto/get-session.dto'import { ErrorDTO } from './dto/error.dto'import { GetErrorsDto } from './dto/get-errors.dto'-import { GetErrorDTO } from './dto/get-error.dto'+import { GetErrorDto } from './dto/get-error.dto'import { PatchStatusDTO } from './dto/patch-status.dto'import {customEventTransformer,@@ -221,14 +220,13 @@ export class AnalyticsController {constructor(private readonly analyticsService: AnalyticsService,private readonly logger: AppLoggerService,- private readonly projectService: ProjectService,) {}@ApiBearerAuth()@Get()@Auth([], true, true)async getData(- @Query() data: AnalyticsGET_DTO,+ @Query() data: GetDataDto,@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },isCaptcha = false,@@ -290,7 +288,6 @@ export class AnalyticsController {allowedTumebucketForPeriodAll = res.timeBucket}- this.analyticsService.validateTimebucket(newTimebucket)const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =this.analyticsService.getFiltersQuery(filters,@@ -503,7 +500,7 @@ export class AnalyticsController {@Get('property')@Auth([], true, true)async getPagePropertyMetadata(- @Query() data: GetPagePropertyMetaDTO,+ @Query() data: GetPagePropertyMetaDto,@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<ReturnType<typeof this.analyticsService.getPagePropertyMeta>> {@@ -570,7 +567,7 @@ export class AnalyticsController {@Get('chart')@Auth([], true, true)async getChartData(- @Query() data: AnalyticsGET_DTO,+ @Query() data: GetDataDto,@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -590,7 +587,6 @@ export class AnalyticsController {this.analyticsService.validatePeriod(period)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -639,7 +635,7 @@ export class AnalyticsController {@Get('performance')@Auth([], true, true)async getPerfData(- @Query() data: AnalyticsGET_DTO & { measure: PerfMeasure },+ @Query() data: GetDataDto & { measure: PerfMeasure },@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -688,7 +684,6 @@ export class AnalyticsController {allowedTumebucketForPeriodAll = res.timeBucket}- this.analyticsService.validateTimebucket(newTimeBucket)const [filtersQuery, filtersParams, appliedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.PERFORMANCE)@@ -734,7 +729,7 @@ export class AnalyticsController {@Get('performance/chart')@Auth([], true, true)async getPerfChartData(- @Query() data: AnalyticsGET_DTO & { measure: PerfMeasure },+ @Query() data: GetDataDto & { measure: PerfMeasure },@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -756,7 +751,6 @@ export class AnalyticsController {this.analyticsService.validatePeriod(period)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, appliedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.PERFORMANCE)@@ -804,7 +798,7 @@ export class AnalyticsController {@Get('captcha')@Auth([], true, true)async getCaptchaData(- @Query() data: AnalyticsGET_DTO,+ @Query() data: GetDataDto,@CurrentUserId() uid: string,): Promise<any> {return this.getData(data, uid, {}, true)@@ -1560,7 +1554,6 @@ export class AnalyticsController {timeBucket = getLowestPossibleTimeBucket(period, from, to)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -1700,8 +1693,6 @@ export class AnalyticsController {allowedTumebucketForPeriodAll = res.timeBucket}- this.analyticsService.validateTimebucket(newTimebucket)-const safeTimezone = this.analyticsService.getSafeTimezone(timezone)const { groupFrom, groupTo, groupFromUTC, groupToUTC } =this.analyticsService.getGroupFromTo(@@ -1797,7 +1788,6 @@ export class AnalyticsController {timeBucket = getLowestPossibleTimeBucket(period, from, to)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, appliedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -1840,7 +1830,7 @@ export class AnalyticsController {@Get('get-error')@Auth([], true, true)async getError(- @Query() data: GetErrorDTO,+ @Query() data: GetErrorDto,@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -1884,8 +1874,6 @@ export class AnalyticsController {timeBucket = getLowestPossibleTimeBucket(period, from, to)}- this.analyticsService.validateTimebucket(timeBucket)-const safeTimezone = this.analyticsService.getSafeTimezone(timezone)const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(from,@@ -1992,7 +1980,6 @@ export class AnalyticsController {timeBucketForAllTime = res.timeBucket}- this.analyticsService.validateTimebucket(newTimeBucket)const [filtersQuery, filtersParams, appliedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)diff --git a/backend/apps/production/src/analytics/analytics.service.ts b/backend/apps/production/src/analytics/analytics.service.tsindex c14f9ca0a..a6eb9789d 100644--- a/backend/apps/production/src/analytics/analytics.service.ts+++ b/backend/apps/production/src/analytics/analytics.service.ts@@ -102,7 +102,7 @@ import {BirdseyeCHUptimeResponse,} from './interfaces'import { ErrorDTO } from './dto/error.dto'-import { GetPagePropertyMetaDTO } from './dto/get-page-property-meta.dto'+import { GetPagePropertyMetaDto } from './dto/get-page-property-meta.dto'import { ProjectViewCustomEventMetaValueType } from '../project/entity/project-view-custom-event.entity'import { ProjectViewCustomEventDto } from '../project/dto/create-project-view.dto'@@ -140,14 +140,6 @@ const MEASURES_MAP = {p95: 'quantileExact(0.95)',}-const validTimebuckets = [- TimeBucketType.MINUTE,- TimeBucketType.HOUR,- TimeBucketType.DAY,- TimeBucketType.MONTH,- TimeBucketType.YEAR,-]-// mapping of allowed timebuckets per difference between days// (e.g. if difference is lower than (lt) (including) -> then the specified timebuckets are allowed to be applied)const timeBucketToDays = [@@ -1130,14 +1122,6 @@ export class AnalyticsService {]}- validateTimebucket(tb: TimeBucketType): void {- if (!_includes(validTimebuckets, tb)) {- throw new UnprocessableEntityException(- 'The provided timebucket is incorrect',- )- }- }-generateUInt64(): string {return crypto.randomBytes(8).readBigUInt64BE(0).toString()}@@ -3382,8 +3366,6 @@ export class AnalyticsService {: res.timeBucket[0]}- this.validateTimebucket(newTimebucket)-const safeTimezone = this.getSafeTimezone(timezone)const { groupFromUTC, groupToUTC } = this.getGroupFromTo(from,@@ -3445,7 +3427,7 @@ export class AnalyticsService {}}- async getPagePropertyMeta(data: GetPagePropertyMetaDTO): Promise<{+ async getPagePropertyMeta(data: GetPagePropertyMetaDto): Promise<{result: IAggregatedMetadata[]appliedFilters: GetFiltersQuery[2]}> {@@ -3485,8 +3467,6 @@ export class AnalyticsService {: res.timeBucket[0]}- this.validateTimebucket(newTimebucket)-const safeTimezone = this.getSafeTimezone(timezone)const { groupFromUTC, groupToUTC } = this.getGroupFromTo(from,diff --git a/backend/apps/production/src/analytics/dto/get-custom-event-meta.dto.ts b/backend/apps/production/src/analytics/dto/get-custom-event-meta.dto.tsindex 8f84e6b9f..8fec5f5ff 100644--- a/backend/apps/production/src/analytics/dto/get-custom-event-meta.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-custom-event-meta.dto.ts@@ -1,8 +1,8 @@import { ApiProperty, PickType } from '@nestjs/swagger'import { IsNotEmpty, IsString } from 'class-validator'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetCustomEventMetadata extends PickType(AnalyticsGET_DTO, [+export class GetCustomEventMetadata extends PickType(GetDataDto, ['pid','period','timeBucket',diff --git a/backend/apps/production/src/analytics/dto/get-custom-events.dto.ts b/backend/apps/production/src/analytics/dto/get-custom-events.dto.tsindex 76532db9d..b17e1a414 100644--- a/backend/apps/production/src/analytics/dto/get-custom-events.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-custom-events.dto.ts@@ -1,7 +1,7 @@import { PickType } from '@nestjs/swagger'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetCustomEventsDto extends PickType(AnalyticsGET_DTO, [+export class GetCustomEventsDto extends PickType(GetDataDto, ['pid','period','timeBucket',diff --git a/backend/apps/production/src/analytics/dto/get-error.dto.ts b/backend/apps/production/src/analytics/dto/get-error.dto.tsindex ee8e21b6e..c0d5e892c 100644--- a/backend/apps/production/src/analytics/dto/get-error.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-error.dto.ts@@ -1,8 +1,8 @@import { ApiProperty, PickType } from '@nestjs/swagger'import { IsNotEmpty } from 'class-validator'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetErrorDTO extends PickType(AnalyticsGET_DTO, [+export class GetErrorDto extends PickType(GetDataDto, ['pid','period','from',diff --git a/backend/apps/production/src/analytics/dto/get-errors.dto.ts b/backend/apps/production/src/analytics/dto/get-errors.dto.tsindex 6d85cac2d..97975629d 100644--- a/backend/apps/production/src/analytics/dto/get-errors.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-errors.dto.ts@@ -1,7 +1,7 @@import { PickType, ApiProperty } from '@nestjs/swagger'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetErrorsDto extends PickType(AnalyticsGET_DTO, [+export class GetErrorsDto extends PickType(GetDataDto, ['pid','period','from',diff --git a/backend/apps/production/src/analytics/dto/get-monitor-data.dto.ts b/backend/apps/production/src/analytics/dto/get-monitor-data.dto.tsindex 3eb2a8b43..e66d72cf0 100644--- a/backend/apps/production/src/analytics/dto/get-monitor-data.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-monitor-data.dto.ts@@ -1,5 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsNotEmpty } from 'class-validator'+import { IsEnum, IsNotEmpty } from 'class-validator'import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'import { TimeBucketType } from './getData.dto'@@ -17,6 +17,7 @@ export class GetMonitorDataDto {@ApiProperty({ enum: TimeBucketType })@IsNotEmpty()+ @IsEnum(TimeBucketType, { message: 'The provided timebucket is incorrect' })timeBucket: TimeBucketType@ApiProperty({ required: false })diff --git a/backend/apps/production/src/analytics/dto/get-page-property-meta.dto.ts b/backend/apps/production/src/analytics/dto/get-page-property-meta.dto.tsindex ccd75a113..5f9d7cb8e 100644--- a/backend/apps/production/src/analytics/dto/get-page-property-meta.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-page-property-meta.dto.ts@@ -1,8 +1,8 @@import { ApiProperty, PickType } from '@nestjs/swagger'import { IsNotEmpty, IsString } from 'class-validator'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetPagePropertyMetaDTO extends PickType(AnalyticsGET_DTO, [+export class GetPagePropertyMetaDto extends PickType(GetDataDto, ['pid','period','timeBucket',diff --git a/backend/apps/production/src/analytics/dto/get-sessions.dto.ts b/backend/apps/production/src/analytics/dto/get-sessions.dto.tsindex 55c7358d7..2dfc5d23f 100644--- a/backend/apps/production/src/analytics/dto/get-sessions.dto.ts+++ b/backend/apps/production/src/analytics/dto/get-sessions.dto.ts@@ -1,7 +1,7 @@import { PickType } from '@nestjs/swagger'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetSessionsDto extends PickType(AnalyticsGET_DTO, [+export class GetSessionsDto extends PickType(GetDataDto, ['pid','period','from',diff --git a/backend/apps/production/src/analytics/dto/getData.dto.ts b/backend/apps/production/src/analytics/dto/getData.dto.tsindex c11be4bde..3ccc5bbf2 100644--- a/backend/apps/production/src/analytics/dto/getData.dto.ts+++ b/backend/apps/production/src/analytics/dto/getData.dto.ts@@ -1,5 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsNotEmpty, IsOptional } from 'class-validator'+import { IsNotEmpty, IsOptional, IsEnum } from 'class-validator'import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'export enum TimeBucketType {@@ -16,7 +16,7 @@ export enum ChartRenderMode {}// eslint-disable-next-line @typescript-eslint/naming-convention-export class AnalyticsGET_DTO {+export class GetDataDto {@ApiProperty()@IsNotEmpty()pid: string@@ -26,6 +26,7 @@ export class AnalyticsGET_DTO {@ApiProperty({ enum: TimeBucketType })@IsNotEmpty()+ @IsEnum(TimeBucketType, { message: 'The provided timebucket is incorrect' })timeBucket: TimeBucketType@ApiProperty({ required: false })diff --git a/backend/apps/selfhosted/src/analytics/analytics.controller.ts b/backend/apps/selfhosted/src/analytics/analytics.controller.tsindex cd86de215..b166c029e 100644--- a/backend/apps/selfhosted/src/analytics/analytics.controller.ts+++ b/backend/apps/selfhosted/src/analytics/analytics.controller.ts@@ -39,7 +39,7 @@ import { DEFAULT_TIMEZONE } from '../user/entities/user.entity'import { RolesGuard } from '../auth/guards/roles.guard'import { PageviewsDTO } from './dto/pageviews.dto'import { EventsDTO } from './dto/events.dto'-import { AnalyticsGET_DTO, ChartRenderMode } from './dto/getData.dto'+import { GetDataDto, ChartRenderMode } from './dto/getData.dto'import { GetFiltersDto } from './dto/get-filters.dto'import { GetCustomEventMetadata } from './dto/get-custom-event-meta.dto'import { GetPagePropertyMetaDTO } from './dto/get-page-property-meta.dto'@@ -175,7 +175,7 @@ export class AnalyticsController {@Get()@Auth([], true, true)async getData(- @Query() data: AnalyticsGET_DTO,+ @Query() data: GetDataDto,@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -230,7 +230,6 @@ export class AnalyticsController {allowedTumebucketForPeriodAll = res.timeBucket}- this.analyticsService.validateTimebucket(newTimebucket)const [filtersQuery, filtersParams, parsedFilters, customEVFilterApplied] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -453,7 +452,7 @@ export class AnalyticsController {@Get('chart')@Auth([], true, true)async getChartData(- @Query() data: AnalyticsGET_DTO,+ @Query() data: GetDataDto,@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -473,7 +472,6 @@ export class AnalyticsController {this.analyticsService.validatePeriod(period)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, parsedFilters, customEVFilterApplied] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -520,7 +518,7 @@ export class AnalyticsController {@Get('performance')@Auth([], true, true)async getPerfData(- @Query() data: AnalyticsGET_DTO & { measure: PerfMeasure },+ @Query() data: GetDataDto & { measure: PerfMeasure },@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -567,7 +565,6 @@ export class AnalyticsController {allowedTumebucketForPeriodAll = res.timeBucket}- this.analyticsService.validateTimebucket(newTimeBucket)const [filtersQuery, filtersParams, parsedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.PERFORMANCE)@@ -613,7 +610,7 @@ export class AnalyticsController {@Get('performance/chart')@Auth([], true, true)async getPerfChartData(- @Query() data: AnalyticsGET_DTO & { measure: PerfMeasure },+ @Query() data: GetDataDto & { measure: PerfMeasure },@CurrentUserId() uid: string,@Headers() headers: { 'x-password'?: string },): Promise<any> {@@ -635,7 +632,6 @@ export class AnalyticsController {this.analyticsService.validatePeriod(period)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, parsedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.PERFORMANCE)@@ -1272,7 +1268,6 @@ export class AnalyticsController {timeBucket = getLowestPossibleTimeBucket(period, from, to)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, appliedFilters, customEVFilterApplied] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -1391,7 +1386,6 @@ export class AnalyticsController {timeBucketForAllTime = res.timeBucket}- this.analyticsService.validateTimebucket(newTimeBucket)const [filtersQuery, filtersParams, parsedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -1609,7 +1603,6 @@ export class AnalyticsController {timeBucket = getLowestPossibleTimeBucket(period, from, to)}- this.analyticsService.validateTimebucket(timeBucket)const [filtersQuery, filtersParams, appliedFilters] =this.analyticsService.getFiltersQuery(filters, DataType.ANALYTICS)@@ -1694,8 +1687,6 @@ export class AnalyticsController {timeBucket = getLowestPossibleTimeBucket(period, from, to)}- this.analyticsService.validateTimebucket(timeBucket)-const safeTimezone = this.analyticsService.getSafeTimezone(timezone)const { groupFromUTC, groupToUTC } = this.analyticsService.getGroupFromTo(from,diff --git a/backend/apps/selfhosted/src/analytics/analytics.service.ts b/backend/apps/selfhosted/src/analytics/analytics.service.tsindex 36b939410..9d5b0cfa1 100644--- a/backend/apps/selfhosted/src/analytics/analytics.service.ts+++ b/backend/apps/selfhosted/src/analytics/analytics.service.ts@@ -123,14 +123,6 @@ export const validPeriods = ['all',]-const validTimebuckets = [- TimeBucketType.MINUTE,- TimeBucketType.HOUR,- TimeBucketType.DAY,- TimeBucketType.MONTH,- TimeBucketType.YEAR,-]-const MEASURES_MAP = {average: 'avg',median: 'median',@@ -1084,14 +1076,6 @@ export class AnalyticsService {]}- validateTimebucket(tb: TimeBucketType): void {- if (!_includes(validTimebuckets, tb)) {- throw new UnprocessableEntityException(- 'The provided timebucket is incorrect',- )- }- }-generateUInt64(): string {return crypto.randomBytes(8).readBigUInt64BE(0).toString()}@@ -2762,8 +2746,6 @@ export class AnalyticsService {: res.timeBucket[0]}- this.validateTimebucket(newTimebucket)-const safeTimezone = this.getSafeTimezone(timezone)const { groupFromUTC, groupToUTC } = this.getGroupFromTo(from,@@ -2865,8 +2847,6 @@ export class AnalyticsService {: res.timeBucket[0]}- this.validateTimebucket(newTimebucket)-const safeTimezone = this.getSafeTimezone(timezone)const { groupFromUTC, groupToUTC } = this.getGroupFromTo(from,diff --git a/backend/apps/selfhosted/src/analytics/dto/get-custom-event-meta.dto.ts b/backend/apps/selfhosted/src/analytics/dto/get-custom-event-meta.dto.tsindex 8f84e6b9f..8fec5f5ff 100644--- a/backend/apps/selfhosted/src/analytics/dto/get-custom-event-meta.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/get-custom-event-meta.dto.ts@@ -1,8 +1,8 @@import { ApiProperty, PickType } from '@nestjs/swagger'import { IsNotEmpty, IsString } from 'class-validator'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetCustomEventMetadata extends PickType(AnalyticsGET_DTO, [+export class GetCustomEventMetadata extends PickType(GetDataDto, ['pid','period','timeBucket',diff --git a/backend/apps/selfhosted/src/analytics/dto/get-custom-events.dto.ts b/backend/apps/selfhosted/src/analytics/dto/get-custom-events.dto.tsindex 76532db9d..b17e1a414 100644--- a/backend/apps/selfhosted/src/analytics/dto/get-custom-events.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/get-custom-events.dto.ts@@ -1,7 +1,7 @@import { PickType } from '@nestjs/swagger'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetCustomEventsDto extends PickType(AnalyticsGET_DTO, [+export class GetCustomEventsDto extends PickType(GetDataDto, ['pid','period','timeBucket',diff --git a/backend/apps/selfhosted/src/analytics/dto/get-error.dto.ts b/backend/apps/selfhosted/src/analytics/dto/get-error.dto.tsindex ee8e21b6e..fcef7ea54 100644--- a/backend/apps/selfhosted/src/analytics/dto/get-error.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/get-error.dto.ts@@ -1,8 +1,8 @@import { ApiProperty, PickType } from '@nestjs/swagger'import { IsNotEmpty } from 'class-validator'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetErrorDTO extends PickType(AnalyticsGET_DTO, [+export class GetErrorDTO extends PickType(GetDataDto, ['pid','period','from',diff --git a/backend/apps/selfhosted/src/analytics/dto/get-errors.dto.ts b/backend/apps/selfhosted/src/analytics/dto/get-errors.dto.tsindex 6d85cac2d..97975629d 100644--- a/backend/apps/selfhosted/src/analytics/dto/get-errors.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/get-errors.dto.ts@@ -1,7 +1,7 @@import { PickType, ApiProperty } from '@nestjs/swagger'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetErrorsDto extends PickType(AnalyticsGET_DTO, [+export class GetErrorsDto extends PickType(GetDataDto, ['pid','period','from',diff --git a/backend/apps/selfhosted/src/analytics/dto/get-page-property-meta.dto.ts b/backend/apps/selfhosted/src/analytics/dto/get-page-property-meta.dto.tsindex ccd75a113..768af843b 100644--- a/backend/apps/selfhosted/src/analytics/dto/get-page-property-meta.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/get-page-property-meta.dto.ts@@ -1,8 +1,8 @@import { ApiProperty, PickType } from '@nestjs/swagger'import { IsNotEmpty, IsString } from 'class-validator'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetPagePropertyMetaDTO extends PickType(AnalyticsGET_DTO, [+export class GetPagePropertyMetaDTO extends PickType(GetDataDto, ['pid','period','timeBucket',diff --git a/backend/apps/selfhosted/src/analytics/dto/get-sessions.dto.ts b/backend/apps/selfhosted/src/analytics/dto/get-sessions.dto.tsindex 55c7358d7..2dfc5d23f 100644--- a/backend/apps/selfhosted/src/analytics/dto/get-sessions.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/get-sessions.dto.ts@@ -1,7 +1,7 @@import { PickType } from '@nestjs/swagger'-import { AnalyticsGET_DTO } from './getData.dto'+import { GetDataDto } from './getData.dto'-export class GetSessionsDto extends PickType(AnalyticsGET_DTO, [+export class GetSessionsDto extends PickType(GetDataDto, ['pid','period','from',diff --git a/backend/apps/selfhosted/src/analytics/dto/getData.dto.ts b/backend/apps/selfhosted/src/analytics/dto/getData.dto.tsindex c56c226df..05d6a180a 100644--- a/backend/apps/selfhosted/src/analytics/dto/getData.dto.ts+++ b/backend/apps/selfhosted/src/analytics/dto/getData.dto.ts@@ -1,5 +1,5 @@import { ApiProperty } from '@nestjs/swagger'-import { IsNotEmpty, IsOptional } from 'class-validator'+import { IsEnum, IsNotEmpty, IsOptional } from 'class-validator'import { DEFAULT_TIMEZONE } from '../../user/entities/user.entity'export enum TimeBucketType {@@ -16,7 +16,7 @@ export enum ChartRenderMode {}// eslint-disable-next-line @typescript-eslint/naming-convention-export class AnalyticsGET_DTO {+export class GetDataDto {@ApiProperty()@IsNotEmpty()pid: string@@ -26,6 +26,7 @@ export class AnalyticsGET_DTO {@ApiProperty({ enum: TimeBucketType })@IsNotEmpty()+ @IsEnum(TimeBucketType, { message: 'The provided timebucket is incorrect' })timeBucket: TimeBucketType@ApiProperty()