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!

add new apipoint

Maksim Mrugf5f11dcf7e77
diff --git a/apps/production/src/project/project.controller.ts b/apps/production/src/project/project.controller.ts
index 53a642aec..3e778f05f 100644
--- a/apps/production/src/project/project.controller.ts
+++ b/apps/production/src/project/project.controller.ts
@@ -604,6 +604,35 @@ export class ProjectController {
await this.projectService.removeDataFromClickhouse(pid, from, to)
}
+ @Delete('/reset-filters/:pid')
+ @ApiResponse({ status: 200 })
+ @UseGuards(JwtAccessTokenGuard, RolesGuard)
+ @Auth([UserType.ADMIN, UserType.CUSTOMER])
+ async resetFilters(
+ @Param('pid') pid: string,
+ @CurrentUserId() uid: string,
+ ): Promise<void> {
+ this.logger.log({ pid }, 'DELETE /reset-filters/:pid')
+
+ if (!isValidPID(pid)) {
+ throw new BadRequestException(
+ 'The provided Project ID (pid) is incorrect',
+ )
+ }
+
+ const project = await this.projectService.findOne(pid, {
+ relations: ['admin', 'share'],
+ })
+
+ if (!project) {
+ throw new NotFoundException('Project not found')
+ }
+
+ this.projectService.allowedToManage(project, uid)
+
+ await this.projectService.resetFilters(pid)
+ }
+
@Post('/:pid/share')
@HttpCode(200)
@UseGuards(JwtAccessTokenGuard, RolesGuard)