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!

lint:fix

Blue Mouse97b3c16e2857
diff --git a/apps/production/src/alert/alert.service.ts b/apps/production/src/alert/alert.service.ts
index 9d7527b5f..a215b6627 100644
--- a/apps/production/src/alert/alert.service.ts
+++ b/apps/production/src/alert/alert.service.ts
@@ -1,10 +1,7 @@
import { Injectable } from '@nestjs/common'
import { InjectRepository } from '@nestjs/typeorm'
import { Repository } from 'typeorm'
-import {
- Pagination,
- PaginationOptionsInterface,
-} from 'src/common/pagination'
+import { Pagination, PaginationOptionsInterface } from 'src/common/pagination'
import { Alert } from './entity/alert.entity'
import { AlertDTO } from './dto/alert.dto'
diff --git a/apps/production/src/alert/entity/alert.entity.ts b/apps/production/src/alert/entity/alert.entity.ts
index dddce5cc2..4cede0045 100644
--- a/apps/production/src/alert/entity/alert.entity.ts
+++ b/apps/production/src/alert/entity/alert.entity.ts
@@ -2,11 +2,7 @@ import { Entity, Column, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'
import { ApiProperty } from '@nestjs/swagger'
import { Project } from 'src/project/entity/project.entity'
-import {
- QueryCondition,
- QueryMetric,
- QueryTime,
-} from 'src/alert/dto/alert.dto'
+import { QueryCondition, QueryMetric, QueryTime } from 'src/alert/dto/alert.dto'
@Entity()
export class Alert {
diff --git a/apps/production/src/auth/guards/api-key-rate-limit.guard.ts b/apps/production/src/auth/guards/api-key-rate-limit.guard.ts
index 96b762c5c..8ce458501 100644
--- a/apps/production/src/auth/guards/api-key-rate-limit.guard.ts
+++ b/apps/production/src/auth/guards/api-key-rate-limit.guard.ts
@@ -1,9 +1,6 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'
import { checkRateLimitForApiKey } from 'src/common/utils'
-import {
- ACCOUNT_PLANS,
- PlanCode,
-} from 'src/user/entities/user.entity'
+import { ACCOUNT_PLANS, PlanCode } from 'src/user/entities/user.entity'
@Injectable()
export class ApiKeyRateLimitGuard implements CanActivate {
diff --git a/apps/production/src/project/project.service.ts b/apps/production/src/project/project.service.ts
index 1f6c49dd8..81e9d5b09 100644
--- a/apps/production/src/project/project.service.ts
+++ b/apps/production/src/project/project.service.ts
@@ -9,14 +9,10 @@ import {
import { InjectRepository } from '@nestjs/typeorm'
import { Repository } from 'typeorm'
import * as _isEmpty from 'lodash/isEmpty'
-import * as _isString from 'lodash/isString'
import * as _size from 'lodash/size'
import * as _join from 'lodash/join'
-import * as _find from 'lodash/find'
import * as _map from 'lodash/map'
import * as _pick from 'lodash/pick'
-import * as _isNull from 'lodash/isNull'
-import * as _split from 'lodash/split'
import * as _trim from 'lodash/trim'
import * as _findIndex from 'lodash/findIndex'
import * as _includes from 'lodash/includes'
diff --git a/apps/production/src/task-manager/task-manager.service.ts b/apps/production/src/task-manager/task-manager.service.ts
index 699e1d645..5dfa0722c 100644
--- a/apps/production/src/task-manager/task-manager.service.ts
+++ b/apps/production/src/task-manager/task-manager.service.ts
@@ -13,11 +13,7 @@ import * as _now from 'lodash/now'
import * as _find from 'lodash/find'
import { AlertService } from 'src/alert/alert.service'
-import {
- QueryCondition,
- QueryMetric,
- QueryTime,
-} from 'src/alert/dto/alert.dto'
+import { QueryCondition, QueryMetric, QueryTime } from 'src/alert/dto/alert.dto'
import { ExtensionsService } from 'src/marketplace/extensions/extensions.service'
import { Extension } from 'src/marketplace/extensions/entities/extension.entity'
import { ReportFrequency } from 'src/project/enums'
diff --git a/apps/production/src/user/user.controller.ts b/apps/production/src/user/user.controller.ts
index a4fbe881a..60f746db8 100644
--- a/apps/production/src/user/user.controller.ts
+++ b/apps/production/src/user/user.controller.ts
@@ -83,9 +83,8 @@ export class UserController {
@Get('/me')
@UseGuards(RolesGuard)
@Roles(UserType.CUSTOMER, UserType.ADMIN)
- async me(@CurrentUserId() user_id: string): Promise<User> {
+ async me(@CurrentUserId() user_id: string): Promise<Partial<User>> {
this.logger.log({ user_id }, 'GET /user/me')
- let user
const sharedProjects = await this.projectService.findShare({
where: {
@@ -93,7 +92,7 @@ export class UserController {
},
relations: ['project'],
})
- user = this.userService.processUser(
+ const user = this.userService.processUser(
await this.userService.findOneWhere({ id: user_id }),
)
@@ -385,7 +384,7 @@ export class UserController {
async update(
@Body() userDTO: AdminUpdateUserProfileDTO,
@Param('id') id: string,
- ): Promise<User> {
+ ): Promise<Partial<User>> {
this.logger.log({ userDTO, id }, 'PUT /user/:id')
if (userDTO.password) {
@@ -441,7 +440,7 @@ export class UserController {
@Body() userDTO: UpdateUserProfileDTO,
@CurrentUserId() id: string,
@Req() request: Request,
- ): Promise<User> {
+ ): Promise<Partial<User>> {
this.logger.log({ userDTO, id }, 'PUT /user')
const user = await this.userService.findOneWhere({ id })
diff --git a/apps/production/src/user/user.service.ts b/apps/production/src/user/user.service.ts
index 5dce3b3a8..dc22d550d 100644
--- a/apps/production/src/user/user.service.ts
+++ b/apps/production/src/user/user.service.ts
@@ -69,7 +69,7 @@ export class UserService {
return this.usersRepository.count()
}
- omitSensitiveData(user: User): User {
+ omitSensitiveData(user: Partial<User>): Partial<User> {
return _omit(user, [
'password',
'twoFactorRecoveryCode',
@@ -139,7 +139,7 @@ export class UserService {
}
}
- processUser(user: User): object {
+ processUser(user: User): Partial<User> {
// @ts-ignore
const maxEventsCount = ACCOUNT_PLANS[user?.planCode]?.monthlyUsageLimit || 0
const userData = {
diff --git a/apps/production/src/webhook/webhook.controller.ts b/apps/production/src/webhook/webhook.controller.ts
index e0655b449..b6e630564 100644
--- a/apps/production/src/webhook/webhook.controller.ts
+++ b/apps/production/src/webhook/webhook.controller.ts
@@ -5,7 +5,6 @@ import {
Headers,
BadRequestException,
NotFoundException,
- UseGuards,
Ip,
} from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
@@ -120,17 +119,17 @@ export class WebhookController {
break
}
- case 'subscription_payment_refunded': {
- const { subscription_id: subID } = body
+ // case 'subscription_payment_refunded': {
+ // const { subscription_id: subID } = body
- await this.userService.updateBySubID(subID, {
- planCode: PlanCode.none,
- billingFrequency: BillingFrequency.Monthly,
- nextBillDate: null,
- })
+ // await this.userService.updateBySubID(subID, {
+ // planCode: PlanCode.none,
+ // billingFrequency: BillingFrequency.Monthly,
+ // nextBillDate: null,
+ // })
- break
- }
+ // break
+ // }
case 'subscription_payment_failed': {
const { subscription_id: subID, attempt_number: attemptNumber } = body
diff --git a/apps/selfhosted/src/analytics/analytics.controller.ts b/apps/selfhosted/src/analytics/analytics.controller.ts
index 70352fc91..95972434a 100644
--- a/apps/selfhosted/src/analytics/analytics.controller.ts
+++ b/apps/selfhosted/src/analytics/analytics.controller.ts
@@ -1,6 +1,5 @@
import * as _isEmpty from 'lodash/isEmpty'
import * as _isArray from 'lodash/isArray'
-import * as _toNumber from 'lodash/toNumber'
import * as _pick from 'lodash/pick'
import * as _map from 'lodash/map'
import * as _uniqBy from 'lodash/uniqBy'
@@ -52,11 +51,7 @@ import {
redis,
REDIS_LOG_CUSTOM_CACHE_KEY,
HEARTBEAT_SID_LIFE_TIME,
- REDIS_USERS_COUNT_KEY,
- REDIS_PROJECTS_COUNT_KEY,
- REDIS_PAGEVIEWS_COUNT_KEY,
REDIS_SESSION_SALT_KEY,
- REDIS_PERFORMANCE_COUNT_KEY,
clickhouse,
} from '../common/constants'
import { BotDetection } from '../common/decorators/bot-detection.decorator'
diff --git a/apps/selfhosted/src/analytics/analytics.service.ts b/apps/selfhosted/src/analytics/analytics.service.ts
index 59096ed67..4d6ba1684 100644
--- a/apps/selfhosted/src/analytics/analytics.service.ts
+++ b/apps/selfhosted/src/analytics/analytics.service.ts
@@ -209,8 +209,8 @@ export class AnalyticsService {
constructor(private readonly projectService: ProjectService) {}
async checkProjectAccess(pid: string, uid: string | null): Promise<void> {
- // const project = await this.projectService.getRedisProject(pid)
- // this.projectService.allowedToView(project, uid)
+ const project = await this.projectService.getRedisProject(pid)
+ this.projectService.allowedToView(project, uid)
}
checkOrigin(project: Project, origin: string): void {
diff --git a/apps/selfhosted/src/auth/strategies/jwt-access-token.strategy.ts b/apps/selfhosted/src/auth/strategies/jwt-access-token.strategy.ts
index 2d877c036..c601d8530 100644
--- a/apps/selfhosted/src/auth/strategies/jwt-access-token.strategy.ts
+++ b/apps/selfhosted/src/auth/strategies/jwt-access-token.strategy.ts
@@ -3,10 +3,7 @@ import { ConfigService } from '@nestjs/config'
import { PassportStrategy } from '@nestjs/passport'
import { Strategy, ExtractJwt } from 'passport-jwt'
-import {
- SELFHOSTED_UUID,
- JWT_ACCESS_TOKEN_SECRET,
-} from 'src/common/constants'
+import { SELFHOSTED_UUID, JWT_ACCESS_TOKEN_SECRET } from 'src/common/constants'
import { generateSelfhostedUser } from 'src/user/entities/user.entity'
import { IJwtPayload } from '../interfaces'
diff --git a/apps/selfhosted/src/common/constants.ts b/apps/selfhosted/src/common/constants.ts
index 8a89bc674..f6e34239e 100644
--- a/apps/selfhosted/src/common/constants.ts
+++ b/apps/selfhosted/src/common/constants.ts
@@ -1,6 +1,5 @@
import { ClickHouse } from 'clickhouse'
import Redis from 'ioredis'
-import { hash } from 'blake3'
import * as _toNumber from 'lodash/toNumber'
import { getSelfhostedUUID } from './utils'
diff --git a/apps/selfhosted/src/common/utils.ts b/apps/selfhosted/src/common/utils.ts
index 215f9b3b2..d64a27bcc 100644
--- a/apps/selfhosted/src/common/utils.ts
+++ b/apps/selfhosted/src/common/utils.ts
@@ -1,8 +1,6 @@
import { NotFoundException, HttpException } from '@nestjs/common'
import { hash } from 'blake3'
import { v5 as uuidv5 } from 'uuid'
-import * as randomstring from 'randomstring'
-import * as _sample from 'lodash/sample'
import * as _join from 'lodash/join'
import * as _filter from 'lodash/filter'
import * as _values from 'lodash/values'
diff --git a/apps/selfhosted/src/project/project.controller.ts b/apps/selfhosted/src/project/project.controller.ts
index 1db78e220..40c7d85d0 100644
--- a/apps/selfhosted/src/project/project.controller.ts
+++ b/apps/selfhosted/src/project/project.controller.ts
@@ -161,7 +161,6 @@ export class ProjectController {
@Param('pid') pid: string,
@Query('from') from: string,
@Query('to') to: string,
- @CurrentUserId() uid: string,
): Promise<void> {
this.logger.log({ from, to, pid }, 'DELETE /partially/:id')
diff --git a/apps/selfhosted/src/project/project.service.ts b/apps/selfhosted/src/project/project.service.ts
index b4573e329..3b66973e9 100644
--- a/apps/selfhosted/src/project/project.service.ts
+++ b/apps/selfhosted/src/project/project.service.ts
@@ -12,11 +12,9 @@ import * as _size from 'lodash/size'
import * as _join from 'lodash/join'
import * as _find from 'lodash/find'
import * as _map from 'lodash/map'
-import * as _pick from 'lodash/pick'
import * as _isNull from 'lodash/isNull'
import * as _split from 'lodash/split'
import * as _trim from 'lodash/trim'
-import * as _findIndex from 'lodash/findIndex'
// @ts-ignore
import * as validateIP from 'validate-ip-node'
@@ -45,8 +43,6 @@ export const deleteProjectRedis = async (id: string) => {
@Injectable()
export class ProjectService {
- constructor() {}
-
async getRedisProject(pid: string): Promise<Project | null> {
const pidKey = getRedisProjectKey(pid)
let project: string | Project = await redis.get(pidKey)
diff --git a/apps/selfhosted/src/user/user.service.ts b/apps/selfhosted/src/user/user.service.ts
index aa11b6ab1..5e34520ed 100644
--- a/apps/selfhosted/src/user/user.service.ts
+++ b/apps/selfhosted/src/user/user.service.ts
@@ -1,6 +1,4 @@
import { Injectable } from '@nestjs/common'
@Injectable()
-export class UserService {
- constructor() {}
-}
+export class UserService {}