📈 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
update
kruzhambus72b9728a85ff
diff --git a/docker-compose.yml b/docker-compose.ymlindex 0e1b339d6..5069b87f8 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -1,37 +1,29 @@-version: '3'+version: ${DOCKER_COMPOSE_VERSION}services:- # clickhouse:- # image: clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}- # container_name: clickhouse- # environment:- # - CLICKHOUSE_USER=${CLICKHOUSE_USER}- # - CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD}- # - CLICKHOUSE_DB=${CLICKHOUSE_DB}- # ports:- # - '8123:8123'- # volumes:- # - clickhouse:/var/lib/clickhousemysql:image: mysql:${MYSQL_VERSION}- container_name: mysql+ container_name: swetrix-api-mysqlenvironment:- - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}- - MYSQL_USER=${MYSQL_USER}- - MYSQL_PASSWORD=${MYSQL_PASSWORD}- - MYSQL_DATABASE=${MYSQL_DATABASE}+ - MYSQL_ALLOW_EMPTY_PASSWORD=yesports:- - '3306:3306'- volumes:- - mysql:/var/lib/mysql+ - ${MYSQL_PORT}:3306redis:image: redis:${REDIS_VERSION}- container_name: redis- # command: redis-server --requirepass ${REDIS_PASSWORD}+ container_name: swetrix-api-redisports:- - '6379:6379'- volumes:- - redis:/var/lib/redis-volumes:- # clickhouse:- mysql:- redis:+ - ${REDIS_PORT}:6379+ clickhouse:+ image: clickhouse/clickhouse-server:${CLICKHOUSE_VERSION}+ container_name: swetrix-api-clickhouse+ ports:+ - ${CLICKHOUSE_PORT}:8123+ redis-commander:+ image: rediscommander/redis-commander:${REDIS_COMMANDER_VERSION}+ container_name: swetrix-api-redis-commander+ environment:+ - REDIS_HOSTS=redis+ ports:+ - ${REDIS_COMMANDER_PORT}:8081+networks:+ default:+ name: swetrix-api\ No newline at end of filediff --git a/src/user/dto/update-user.dto.ts b/src/user/dto/update-user.dto.tsindex 7b7d43fda..7b51bd504 100644--- a/src/user/dto/update-user.dto.ts+++ b/src/user/dto/update-user.dto.ts@@ -1,5 +1,6 @@import { ApiProperty } from '@nestjs/swagger'import { IsEmail } from 'class-validator'+import { TimeFormat } from '../entities/user.entity'export class UpdateUserProfileDTO {@ApiProperty({ example: '[email protected]', required: true })@@ -17,4 +18,7 @@ export class UpdateUserProfileDTO {@ApiProperty({ example: '1234567890' })telegramChatId: string | null++ @ApiProperty({ example: '24-hour', enum: TimeFormat })+ timeFormat: string}diff --git a/src/user/user.controller.ts b/src/user/user.controller.tsindex e661a39c7..4e13344a1 100644--- a/src/user/user.controller.ts+++ b/src/user/user.controller.ts@@ -501,6 +501,12 @@ export class UserController {)}+ if (userDTO.timeFormat && user.timeFormat !== userDTO.timeFormat) {+ await this.userService.update(id, {+ timeFormat: userDTO.timeFormat,+ })+ }+// delete internal properties from userDTO before updating it// todo: use _pick instead of _omitconst userToUpdate = _omit(userDTO, [@@ -592,22 +598,4 @@ export class UserController {return user}-- @Put('/change-time-format')- @UseGuards(RolesGuard)- @UseGuards(SelfhostedGuard)- @Roles(UserType.CUSTOMER, UserType.ADMIN)- async changeTimeFormat(- @CurrentUserId() userId: string,- @Body('timeFormat') timeFormat: TimeFormat,- ): Promise<User> {- this.logger.log({ userId, timeFormat }, 'PUT /user/change-time-format')- const user = await this.userService.findOneWhere({ id: userId })- if (user.timeFormat === timeFormat) {- throw new BadRequestException('Time format is already set to this value')- }-- await this.userService.update(userId, { timeFormat })- return this.userService.omitSensitiveData(user)- }}