📈 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
Proper take/skip values validation
Blue Mouse61b255be47f6
diff --git a/backend/apps/cloud/src/alert/alert.controller.ts b/backend/apps/cloud/src/alert/alert.controller.tsindex fe4a397d7..1c1ffb9c8 100644--- a/backend/apps/cloud/src/alert/alert.controller.ts+++ b/backend/apps/cloud/src/alert/alert.controller.ts@@ -13,6 +13,7 @@ import {BadRequestException,HttpException,HttpStatus,+ ParseIntPipe,} from '@nestjs/common'import { In } from 'typeorm'import { ApiTags, ApiResponse, ApiBearerAuth } from '@nestjs/swagger'@@ -86,8 +87,8 @@ export class AlertController {async getProjectAlerts(@CurrentUserId() userId: string,@Param('projectId') projectId: string,- @Query('take') take: number | undefined,- @Query('skip') skip: number | undefined,+ @Query('take', new ParseIntPipe({ optional: true })) take?: number,+ @Query('skip', new ParseIntPipe({ optional: true })) skip?: number,) {this.logger.log({ userId, projectId, take, skip }, 'GET /alert/:projectId')diff --git a/backend/apps/cloud/src/organisation/organisation.controller.ts b/backend/apps/cloud/src/organisation/organisation.controller.tsindex 6888deab2..91d24b1ab 100644--- a/backend/apps/cloud/src/organisation/organisation.controller.ts+++ b/backend/apps/cloud/src/organisation/organisation.controller.ts@@ -13,6 +13,7 @@ import {Query,ForbiddenException,Patch,+ ParseIntPipe,} from '@nestjs/common'import { ApiBearerAuth, ApiQuery, ApiResponse } from '@nestjs/swagger'import { isEmpty as _isEmpty, find as _find, trim as _trim } from 'lodash'@@ -65,9 +66,9 @@ export class OrganisationController {@Auth([], true)async get(@CurrentUserId() userId: string,- @Query('take') take: number | undefined,- @Query('skip') skip: number | undefined,- @Query('search') search: string | undefined,+ @Query('take', new ParseIntPipe({ optional: true })) take?: number,+ @Query('skip', new ParseIntPipe({ optional: true })) skip?: number,+ @Query('search') search?: string,): Promise<Pagination<Organisation> | Organisation[] | object> {this.logger.log({ userId, take, skip }, 'GET /organisation')diff --git a/backend/apps/cloud/src/project/project.controller.ts b/backend/apps/cloud/src/project/project.controller.tsindex 8bfcaac85..25b1f1934 100644--- a/backend/apps/cloud/src/project/project.controller.ts+++ b/backend/apps/cloud/src/project/project.controller.ts@@ -21,6 +21,7 @@ import {Res,UnauthorizedException,UnprocessableEntityException,+ ParseIntPipe,} from '@nestjs/common'import { Response } from 'express'import {@@ -161,17 +162,16 @@ export class ProjectController {@Auth([], true)async get(@CurrentUserId() userId: string,- @Query('take') take: number | undefined,- @Query('skip') skip: number | undefined,- @Query('search') search: string | undefined,+ @Query('take', new ParseIntPipe({ optional: true })) take?: number,+ @Query('skip', new ParseIntPipe({ optional: true })) skip?: number,+ @Query('search') search?: string,@Query('mode')- mode:+ mode?:| 'default'| 'high-traffic'| 'low-traffic'| 'performance'- | 'lost-traffic'- | undefined,+ | 'lost-traffic',@Query('period')period: '1h' | '1d' | '7d' | '4w' | '3M' | '12M' | '24M' | 'all' = '7d',@Query('use-hostname-navigation')@@ -254,9 +254,9 @@ export class ProjectController {@Auth([], true)async getAvailableProjectsForOrganization(@CurrentUserId() userId: string,- @Query('take') take: number | undefined,- @Query('skip') skip: number | undefined,- @Query('search') search: string | undefined,+ @Query('take', new ParseIntPipe({ optional: true })) take?: number,+ @Query('skip', new ParseIntPipe({ optional: true })) skip?: number,+ @Query('search') search?: string,): Promise<Pagination<Project> | Project[] | object> {this.logger.log({ userId, take, skip },diff --git a/backend/apps/cloud/src/user/user.controller.ts b/backend/apps/cloud/src/user/user.controller.tsindex 0b0d32024..c979ffb3e 100644--- a/backend/apps/cloud/src/user/user.controller.ts+++ b/backend/apps/cloud/src/user/user.controller.ts@@ -17,6 +17,7 @@ import {Ip,Patch,NotFoundException,+ ParseIntPipe,} from '@nestjs/common'import { Request } from 'express'import { ApiTags, ApiQuery, ApiResponse, ApiBearerAuth } from '@nestjs/swagger'@@ -132,8 +133,8 @@ export class UserController {@UseGuards(JwtAccessTokenGuard, RolesGuard)@Roles(UserType.ADMIN)async get(- @Query('take') take: number | undefined,- @Query('skip') skip: number | undefined,+ @Query('take', new ParseIntPipe({ optional: true })) take?: number,+ @Query('skip', new ParseIntPipe({ optional: true })) skip?: number,): Promise<Pagination<User> | User[]> {this.logger.log({ take, skip }, 'GET /user')return this.userService.paginate({ take, skip })@@ -900,28 +901,6 @@ export class UserController {}}- // @ApiBearerAuth()- // @Get('payouts/list')- // @ApiQuery({ name: 'take', required: false })- // @ApiQuery({ name: 'skip', required: false })- // @UseGuards(JwtAccessTokenGuard, RolesGuard)- // @Roles(UserType.CUSTOMER, UserType.ADMIN)- // async getPayoutsList(- // @CurrentUserId() id: string,- // @Query('take') take: number | undefined,- // @Query('skip') skip: number | undefined,- // ): Promise<Pagination<Payout> | Payout[]> {- // this.logger.log({ id, take, skip }, 'GET /user/payouts/list')-- // const user = await this.userService.findOne({ where: { id } })-- // if (!user) {- // throw new BadRequestException('User not found')- // }-- // return this.userService.getPayoutsList(user)- // }-@ApiBearerAuth()@Get('referrals')@UseGuards(JwtAccessTokenGuard, RolesGuard)diff --git a/backend/apps/community/src/project/project.controller.ts b/backend/apps/community/src/project/project.controller.tsindex fa062ecb4..c02e3e6ca 100644--- a/backend/apps/community/src/project/project.controller.ts+++ b/backend/apps/community/src/project/project.controller.ts@@ -15,6 +15,7 @@ import {UnauthorizedException,Patch,HttpStatus,+ ParseIntPipe,} from '@nestjs/common'import { v4 as uuidv4 } from 'uuid'import {@@ -109,9 +110,9 @@ export class ProjectController {@Auth([], true)async get(@CurrentUserId() userId: string,- @Query('take') take: number | undefined,- @Query('skip') skip: number | undefined,- @Query('search') search: string | undefined,+ @Query('take', new ParseIntPipe({ optional: true })) take?: number,+ @Query('skip', new ParseIntPipe({ optional: true })) skip?: number,+ @Query('search') search?: string,@Query('sort')sort?: 'alpha_asc' | 'alpha_desc' | 'date_asc' | 'date_desc',): Promise<Pagination<Project> | Project[] | object> {