📈 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
Remove redundant userId check from getFullProject
Blue Mouse894cc868c903
diff --git a/backend/apps/cloud/src/project/project.controller.ts b/backend/apps/cloud/src/project/project.controller.tsindex 13836eb03..93b1068c5 100644--- a/backend/apps/cloud/src/project/project.controller.ts+++ b/backend/apps/cloud/src/project/project.controller.ts@@ -244,7 +244,7 @@ export class ProjectController {throw new BadRequestException('The provided project ID is incorrect')}- const project = await this.projectService.getFullProject(projectId, userId)+ const project = await this.projectService.getFullProject(projectId)if (!project) {throw new NotFoundException('Project not found')@@ -278,7 +278,7 @@ export class ProjectController {throw new BadRequestException('The provided project ID is incorrect')}- const project = await this.projectService.getFullProject(projectId, userId)+ const project = await this.projectService.getFullProject(projectId)if (!project) {throw new NotFoundException('Project not found')@@ -437,10 +437,7 @@ export class ProjectController {)}- const project = await this.projectService.getFullProject(- funnelDTO.pid,- userId,- )+ const project = await this.projectService.getFullProject(funnelDTO.pid)if (!project) {throw new NotFoundException('Project not found.')@@ -486,11 +483,9 @@ export class ProjectController {)}- const project = await this.projectService.getFullProject(- funnelDTO.pid,- userId,- ['funnels'],- )+ const project = await this.projectService.getFullProject(funnelDTO.pid, [+ 'funnels',+ ])if (!project) {throw new NotFoundException('Project not found.')@@ -538,7 +533,7 @@ export class ProjectController {throw new UnauthorizedException('Please auth first')}- const project = await this.projectService.getFullProject(pid, userId)+ const project = await this.projectService.getFullProject(pid)if (!project) {throw new NotFoundException('Project not found')@@ -576,7 +571,7 @@ export class ProjectController {throw new UnauthorizedException('Please auth first')}- const project = await this.projectService.getFullProject(pid, userId)+ const project = await this.projectService.getFullProject(pid)if (!project) {throw new NotFoundException('Project not found.')@@ -612,10 +607,7 @@ export class ProjectController {throw new ForbiddenException('Please, verify your email address first')}- const project = await this.projectService.getFullProject(- annotationDTO.pid,- userId,- )+ const project = await this.projectService.getFullProject(annotationDTO.pid)if (!project) {throw new NotFoundException('Project not found.')@@ -654,10 +646,7 @@ export class ProjectController {throw new ForbiddenException('Please, verify your email address first')}- const project = await this.projectService.getFullProject(- annotationDTO.pid,- userId,- )+ const project = await this.projectService.getFullProject(annotationDTO.pid)if (!project) {throw new NotFoundException('Project not found.')@@ -691,7 +680,7 @@ export class ProjectController {throw new UnauthorizedException('Please auth first')}- const project = await this.projectService.getFullProject(pid, userId)+ const project = await this.projectService.getFullProject(pid)if (!project) {throw new NotFoundException('Project not found')@@ -1878,9 +1867,7 @@ export class ProjectController {)}- const project = await this.projectService.getFullProject(id, null, [- 'funnels',- ])+ const project = await this.projectService.getFullProject(id, ['funnels'])if (_isEmpty(project)) {throw new NotFoundException('Project was not found in the database')diff --git a/backend/apps/cloud/src/project/project.service.ts b/backend/apps/cloud/src/project/project.service.tsindex 726596ed0..b4c5cfd23 100644--- a/backend/apps/cloud/src/project/project.service.ts+++ b/backend/apps/cloud/src/project/project.service.ts@@ -234,13 +234,10 @@ export class ProjectService {}// Instead of passing relations to the findOne method every time, this method returns a project- // with necessary relations needed for the allowedToView and allowedToManage methods- async getFullProject(- pid: string,- userId?: string,- additionalRelations: string[] = [],- ) {- const query: FindOneOptions<Project> = {+ // with necessary relations needed for the allowedToView and allowedToManage methods.+ // Authorisation should be handled separately via allowedToView/allowedToManage.+ async getFullProject(pid: string, additionalRelations: string[] = []) {+ return this.projectsRepository.findOne({where: { id: pid },relations: ['share',@@ -278,16 +275,7 @@ export class ProjectService {},},},- }-- if (userId) {- query.where = {- id: pid,- admin: { id: userId },- } as FindOptionsWhere<Project>- }-- return this.projectsRepository.findOne(query)+ })}async paginate(