📈 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
add to promise
Maksim Mrugaff9c7542b8b
diff --git a/apps/production/src/project/project.controller.ts b/apps/production/src/project/project.controller.tsindex 121fdc9fb..c70ee408d 100644--- a/apps/production/src/project/project.controller.ts+++ b/apps/production/src/project/project.controller.ts@@ -610,6 +610,8 @@ export class ProjectController {@Auth([UserType.ADMIN, UserType.CUSTOMER])async resetFilters(@Param('pid') pid: string,+ @Query('type') type: string,+ @Query('filters') filter: string,@CurrentUserId() uid: string,): Promise<void> {this.logger.log({ pid }, 'DELETE /reset-filters/:pid')@@ -628,9 +630,15 @@ export class ProjectController {throw new NotFoundException('Project not found')}+ const filters = JSON.parse(filter)+this.projectService.allowedToManage(project, uid)- // await this.projectService.resetFilters(pid)+ await Promise.all([+ ..._map(filters, async (f: string) => {+ this.projectService.resetFilters(pid, type, f)+ }),+ ])}@Post('/:pid/share')diff --git a/apps/production/src/project/project.service.ts b/apps/production/src/project/project.service.tsindex 66c09c50e..86b24e7a4 100644--- a/apps/production/src/project/project.service.ts+++ b/apps/production/src/project/project.service.ts@@ -517,6 +517,16 @@ export class ProjectService {}}+ async resetFilters(+ pid: string,+ type: string,+ filters: string+ ): Promise<void> {+ const query = `DELETE FROM analytics WHERE pid = '${pid}' AND ${type}=${filters};`++ await clickhouse.query(query, { params: { pid } }).toPromise()+ }+async removeDataFromClickhouse(pid: string,from: string,diff --git a/meta/clickhouse/generate-dummy-data.js b/meta/clickhouse/generate-dummy-data.jsindex c8afb6dc3..6029f3cf4 100644--- a/meta/clickhouse/generate-dummy-data.js+++ b/meta/clickhouse/generate-dummy-data.js@@ -46,6 +46,10 @@ const insertData = async (pid, rowCount, processedRecords, table) => {}try {+ // save to file insertQueries+ const fs = require('fs')+ fs.writeFileSync(`./${table}.txt`, insertQueries.join('\n'))+const result = await queriesRunner(insertQueries, false)if (!result) {