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 view for a single project

Yehor Dremliuha31941d993efe
diff --git a/apps/production/src/project/project.controller.ts b/apps/production/src/project/project.controller.ts
index e5c6d71ed..6705fb027 100644
--- a/apps/production/src/project/project.controller.ts
+++ b/apps/production/src/project/project.controller.ts
@@ -1900,6 +1900,36 @@ export class ProjectController {
}
}
+ @ApiOperation({ summary: 'Get project view' })
+ @ApiOkResponse({ type: ProjectViewEntity })
+ @ApiBearerAuth()
+ @Get(':projectId/views/:viewId')
+ @UseGuards(JwtAccessTokenGuard, RolesGuard)
+ @Roles(UserType.CUSTOMER, UserType.ADMIN)
+ async getProjectView(
+ @Param() params: ProjectViewIdsDto,
+ @CurrentUserId() userId: string
+ ){
+ const project = await this.projectService.findProject(params.projectId, [
+ 'admin',
+ 'share',
+ ])
+
+ if (!project) {
+ throw new NotFoundException('Project not found.')
+ }
+
+ const user = await this.userService.findUserV2(userId, ['roles'])
+
+ if (!user) {
+ throw new NotFoundException('User not found.')
+ }
+
+ this.projectService.allowedToManage(project, userId, user.roles)
+ return this.projectsViewsRepository.findProjectView(params.projectId, params.viewId)
+
+ }
+
@ApiOperation({ summary: 'Create project view' })
@ApiOkResponse({ type: ProjectViewEntity })
@ApiBearerAuth()