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!

applied the eslint auto-fix with updated rules

Blue Mousee984b1556d40
diff --git a/src/Util/Util.ts b/src/Util/Util.ts
index 656123790..bc951160c 100644
--- a/src/Util/Util.ts
+++ b/src/Util/Util.ts
@@ -5,6 +5,7 @@ import { Project } from 'src/project/entity/project.entity'
import { User, UserType } from 'src/user/entities/user.entity'
import { ProjectShare } from '../project/entity/project-share.entity'
import { ProjectDTO } from '../project/dto/project.dto'
+
@Injectable()
export class Util {
getString(): string {
diff --git a/src/action-tokens/action-tokens.service.ts b/src/action-tokens/action-tokens.service.ts
index a8c37a18b..98b63a3ea 100644
--- a/src/action-tokens/action-tokens.service.ts
+++ b/src/action-tokens/action-tokens.service.ts
@@ -43,7 +43,7 @@ export class ActionTokensService {
action: ActionTokenType,
newValue?: string,
) {
- return await this.actionTokensRepository.save({
+ return this.actionTokensRepository.save({
user: { id: userId },
action,
newValue,
@@ -51,7 +51,7 @@ export class ActionTokensService {
}
public async findActionToken(token: string) {
- return await this.actionTokensRepository.findOne(token, {
+ return this.actionTokensRepository.findOne(token, {
relations: ['user'],
})
}
@@ -61,7 +61,7 @@ export class ActionTokensService {
}
async getActionToken(token: string) {
- return await this.actionTokensRepository.findOne({
+ return this.actionTokensRepository.findOne({
where: {
id: token,
},
diff --git a/src/alert/alert.controller.ts b/src/alert/alert.controller.ts
index 5cdbfd137..5bf8a65b0 100644
--- a/src/alert/alert.controller.ts
+++ b/src/alert/alert.controller.ts
@@ -14,9 +14,6 @@ import {
} from '@nestjs/common'
import { In } from 'typeorm'
import { ApiTags, ApiResponse } from '@nestjs/swagger'
-import { AlertService } from './alert.service'
-import { SelfhostedGuard } from '../common/guards/selfhosted.guard'
-import { RolesGuard } from '../auth/guards/roles.guard'
import * as _isEmpty from 'lodash/isEmpty'
import * as _map from 'lodash/map'
import * as _omit from 'lodash/omit'
@@ -25,13 +22,19 @@ import * as _pick from 'lodash/pick'
import { UserService } from 'src/user/user.service'
import { ProjectService } from 'src/project/project.service'
import { AppLoggerService } from 'src/logger/logger.service'
+import {
+ UserType,
+ ACCOUNT_PLANS,
+ PlanCode,
+} from 'src/user/entities/user.entity'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
import { CurrentUserId } from '../auth/decorators/current-user-id.decorator'
import { Roles } from '../auth/decorators/roles.decorator'
-import { UserType } from 'src/user/entities/user.entity'
import { Alert } from './entity/alert.entity'
import { AlertDTO, CreateAlertDTO } from './dto/alert.dto'
-import { ACCOUNT_PLANS, PlanCode } from 'src/user/entities/user.entity'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
+import { RolesGuard } from '../auth/guards/roles.guard'
+import { SelfhostedGuard } from '../common/guards/selfhosted.guard'
+import { AlertService } from './alert.service'
const ALERTS_MAXIMUM = ACCOUNT_PLANS[PlanCode.free].maxAlerts
diff --git a/src/alert/alert.module.ts b/src/alert/alert.module.ts
index aaa598d49..e27a5bcf6 100644
--- a/src/alert/alert.module.ts
+++ b/src/alert/alert.module.ts
@@ -1,11 +1,11 @@
import { Module } from '@nestjs/common'
import { TypeOrmModule } from '@nestjs/typeorm'
-import { Alert } from './entity/alert.entity'
-import { AlertService } from './alert.service'
import { ProjectModule } from 'src/project/project.module'
import { AppLoggerModule } from 'src/logger/logger.module'
import { UserModule } from 'src/user/user.module'
+import { AlertService } from './alert.service'
+import { Alert } from './entity/alert.entity'
import { AlertController } from './alert.controller'
@Module({
diff --git a/src/alert/alert.service.ts b/src/alert/alert.service.ts
index 9795d2260..72cbe0f19 100644
--- a/src/alert/alert.service.ts
+++ b/src/alert/alert.service.ts
@@ -1,9 +1,9 @@
import { Injectable } from '@nestjs/common'
import { InjectRepository } from '@nestjs/typeorm'
import { Repository } from 'typeorm'
+import { Pagination, PaginationOptionsInterface } from 'src/common/pagination'
import { Alert } from './entity/alert.entity'
import { AlertDTO } from './dto/alert.dto'
-import { Pagination, PaginationOptionsInterface } from 'src/common/pagination'
@Injectable()
export class AlertService {
@@ -40,7 +40,7 @@ export class AlertService {
}
async count(options: object = {}): Promise<number> {
- return await this.alertsReporsitory.count(options)
+ return this.alertsReporsitory.count(options)
}
findOne(id: string, params: Object = {}): Promise<Alert | null> {
diff --git a/src/analytics/analytics.controller.spec.ts b/src/analytics/analytics.controller.spec.ts
index afa824dcd..397e15727 100644
--- a/src/analytics/analytics.controller.spec.ts
+++ b/src/analytics/analytics.controller.spec.ts
@@ -1,12 +1,12 @@
import { Test, TestingModule } from '@nestjs/testing'
+import { Repository } from 'typeorm'
+import { getRepositoryToken } from '@nestjs/typeorm'
import { ProjectShare } from '../project/entity/project-share.entity'
import { Project } from '../project/entity/project.entity'
-import { Repository } from 'typeorm'
import { AppLoggerService } from '../logger/logger.service'
import { TaskManagerService } from '../task-manager/task-manager.service'
import { AnalyticsController } from './analytics.controller'
import { AnalyticsService } from './analytics.service'
-import { getRepositoryToken } from '@nestjs/typeorm'
import { ProjectService } from '../project/project.service'
import { MailerService } from '../mailer/mailer.service'
import { UserService } from '../user/user.service'
diff --git a/src/analytics/analytics.controller.ts b/src/analytics/analytics.controller.ts
index ce08a2035..8549ddff4 100644
--- a/src/analytics/analytics.controller.ts
+++ b/src/analytics/analytics.controller.ts
@@ -33,6 +33,8 @@ import { ApiTags } from '@nestjs/swagger'
import * as UAParser from 'ua-parser-js'
import * as isbot from 'isbot'
+import { OptionalJwtAccessTokenGuard } from 'src/auth/guards'
+import { Auth, Public } from 'src/auth/decorators'
import {
AnalyticsService,
getSessionKey,
@@ -64,8 +66,6 @@ import {
} from '../common/constants'
import { BotDetection } from '../common/decorators/bot-detection.decorator'
import { BotDetectionGuard } from '../common/guards/bot-detection.guard'
-import { OptionalJwtAccessTokenGuard } from 'src/auth/guards'
-import { Auth, Public } from 'src/auth/decorators'
const mysql = require('mysql2')
@@ -282,8 +282,8 @@ export class AnalyticsController {
this.analyticsService.getFiltersQuery(filters)
await this.analyticsService.checkProjectAccess(pid, uid)
- let groupFrom = from,
- groupTo = to
+ let groupFrom = from
+ let groupTo = to
let queryCustoms = `SELECT ev, count() FROM customEV WHERE pid = {pid:FixedString(12)} ${filtersQuery} AND created BETWEEN {groupFrom:String} AND {groupTo:String} GROUP BY ev`
// TODO: Refactor
@@ -477,8 +477,8 @@ export class AnalyticsController {
this.analyticsService.getFiltersQuery(filters)
await this.analyticsService.checkProjectAccess(pid, uid)
- let groupFrom = from,
- groupTo = to
+ let groupFrom = from
+ let groupTo = to
const subQuery = `FROM performance WHERE pid = {pid:FixedString(12)} ${filtersQuery} AND created BETWEEN {groupFrom:String} AND {groupTo:String}`
@@ -607,7 +607,7 @@ export class AnalyticsController {
@Query() data: AnalyticsGET_DTO,
@CurrentUserId() uid: string,
): Promise<any> {
- return await this.getData(data, uid, true)
+ return this.getData(data, uid, true)
}
@Get('/birdseye')
@@ -673,7 +673,7 @@ export class AnalyticsController {
}
}
- return await this.taskManagerService.getGeneralStats()
+ return this.taskManagerService.getGeneralStats()
}
@Get('/hb')
@@ -823,7 +823,6 @@ export class AnalyticsController {
await redis.set(`hb:${pid}:${sessionID}`, 1, 'EX', HEARTBEAT_SID_LIFE_TIME)
this.analyticsService.processInteractionSD(sessionID, pid)
- return
}
// Log pageview event
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index 0ea9ba23e..deee02492 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -186,7 +186,7 @@ export class AnalyticsService {
)
}
} else {
- const hostname = new URL(origin).hostname
+ const { hostname } = new URL(origin)
if (!_includes(project.origins, hostname)) {
throw new BadRequestException(
"This origin is prohibited by the project's origins policy",
@@ -411,7 +411,7 @@ export class AnalyticsService {
async isUnique(hash: string) {
const session = await redis.get(hash)
await redis.set(hash, 1, 'EX', UNIQUE_SESSION_LIFE_TIME)
- return !Boolean(session)
+ return !session
}
async isSessionOpen(hash: string) {
@@ -673,7 +673,7 @@ export class AnalyticsService {
const resSize = _size(result)
while (idx < resSize) {
- const index = result[idx].index
+ const { index } = result[idx]
const v = result[idx]['count()']
if (index === result[1 + idx]?.index) {
@@ -686,7 +686,7 @@ export class AnalyticsService {
continue
}
- const unique = result[idx].unique
+ const { unique } = result[idx]
if (unique) {
visits[index] = v
@@ -816,7 +816,7 @@ export class AnalyticsService {
const resSize = _size(result)
while (idx < resSize) {
- const index = result[idx].index
+ const { index } = result[idx]
const v = result[idx]['count()']
results[index] = v
idx++
@@ -935,7 +935,7 @@ export class AnalyticsService {
while (idx < resSize) {
const res = result[idx]
- const index = res.index
+ const { index } = res
dns[index] = _round(millisecondsToSeconds(res['avg(dns)']), 2)
tls[index] = _round(millisecondsToSeconds(res['avg(tls)']), 2)
diff --git a/src/app.module.ts b/src/app.module.ts
index 6fcf84404..087141411 100644
--- a/src/app.module.ts
+++ b/src/app.module.ts
@@ -5,6 +5,7 @@ import { ScheduleModule } from '@nestjs/schedule'
import { TelegrafModule } from 'nestjs-telegraf'
import { NestjsFormDataModule } from 'nestjs-form-data'
+import { I18nModule } from 'nestjs-i18n'
import { UserModule } from './user/user.module'
import { AnalyticsModule } from './analytics/analytics.module'
import { ProjectModule } from './project/project.module'
@@ -17,7 +18,6 @@ import { PingModule } from './ping/ping.module'
import { TGModule } from './tg-integration/tg.module'
import { MarketplaceModule } from './marketplace/marketplace.module'
import { AlertModule } from './alert/alert.module'
-import { I18nModule } from 'nestjs-i18n'
import { getI18nConfig } from './configs'
import { AuthModule } from './auth/auth.module'
import { CaptchaModule } from './captcha/captcha.module'
@@ -33,7 +33,7 @@ const modules = [
password: process.env.MYSQL_ROOT_PASSWORD,
database: process.env.MYSQL_DATABASE,
synchronize: isDevelopment,
- entities: [__dirname + '/**/*.entity{.ts,.js}'],
+ entities: [`${__dirname}/**/*.entity{.ts,.js}`],
}),
I18nModule.forRootAsync(getI18nConfig()),
ScheduleModule.forRoot(),
diff --git a/src/auth/auth.module.ts b/src/auth/auth.module.ts
index 4108922e9..85b92eda0 100644
--- a/src/auth/auth.module.ts
+++ b/src/auth/auth.module.ts
@@ -4,9 +4,9 @@ import { PassportModule } from '@nestjs/passport'
import { ActionTokensModule } from 'src/action-tokens/action-tokens.module'
import { MailerModule } from 'src/mailer/mailer.module'
import { UserModule } from 'src/user/user.module'
+import { ProjectModule } from 'src/project/project.module'
import { AuthController } from './auth.controller'
import { AuthService } from './auth.service'
-import { ProjectModule } from 'src/project/project.module'
import {
ApiKeyStrategy,
JwtAccessTokenStrategy,
diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts
index d8aa36ebc..656f50a24 100644
--- a/src/auth/auth.service.ts
+++ b/src/auth/auth.service.ts
@@ -68,7 +68,7 @@ export class AuthService {
public async hashPassword(password: string): Promise<string> {
const salt = await genSalt(10)
- return await hash(password, salt)
+ return hash(password, salt)
}
public async sendVerificationEmail(userId: string, email: string) {
@@ -114,7 +114,7 @@ export class AuthService {
userId: string,
isSecondFactorAuthenticated = false,
) {
- return await this.jwtService.signAsync(
+ return this.jwtService.signAsync(
{
sub: userId,
isSecondFactorAuthenticated,
@@ -157,7 +157,7 @@ export class AuthService {
password: string,
hashedPassword: string,
): Promise<boolean> {
- return await compare(password, hashedPassword)
+ return compare(password, hashedPassword)
}
public async sendTelegramNotification(
@@ -408,6 +408,6 @@ export class AuthService {
}
async validateApiKey(apiKey: string): Promise<User | null> {
- return await this.userService.findUserByApiKey(apiKey)
+ return this.userService.findUserByApiKey(apiKey)
}
}
diff --git a/src/auth/decorators/current-user-id.decorator.ts b/src/auth/decorators/current-user-id.decorator.ts
index fddcf02e6..629fd4246 100644
--- a/src/auth/decorators/current-user-id.decorator.ts
+++ b/src/auth/decorators/current-user-id.decorator.ts
@@ -3,7 +3,7 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'
export const CurrentUserId = createParamDecorator(
(_: unknown, context: ExecutionContext) => {
const request = context.switchToHttp().getRequest()
- const user = request.user
+ const { user } = request
return user && (user.sub || user.id) ? user.sub || user.id : null
},
)
diff --git a/src/auth/decorators/current-user.decorator.ts b/src/auth/decorators/current-user.decorator.ts
index 0b5e9dac0..9c9d258d4 100644
--- a/src/auth/decorators/current-user.decorator.ts
+++ b/src/auth/decorators/current-user.decorator.ts
@@ -7,7 +7,7 @@ export const CurrentUser = createParamDecorator(
context: ExecutionContext,
) => {
const request = context.switchToHttp().getRequest()
- const user = request.user
+ const { user } = request
return data ? user && user[data] : user
},
diff --git a/src/auth/guards/api-key-rate-limit.guard.ts b/src/auth/guards/api-key-rate-limit.guard.ts
index da9596fa3..8ce458501 100644
--- a/src/auth/guards/api-key-rate-limit.guard.ts
+++ b/src/auth/guards/api-key-rate-limit.guard.ts
@@ -6,14 +6,14 @@ import { ACCOUNT_PLANS, PlanCode } from 'src/user/entities/user.entity'
export class ApiKeyRateLimitGuard implements CanActivate {
async canActivate(context: ExecutionContext) {
const request = context.switchToHttp().getRequest()
- const user = request.user
+ const { user } = request
if (request.headers['x-api-key']) {
if (!user) return false
const reqAmount =
ACCOUNT_PLANS[user.planCode as PlanCode].maxApiKeyRequestsPerHour
- return await checkRateLimitForApiKey(user.apiKey, reqAmount)
+ return checkRateLimitForApiKey(user.apiKey, reqAmount)
}
return true
diff --git a/src/captcha/captcha.controller.ts b/src/captcha/captcha.controller.ts
index 4b127a3ba..c98d03ff4 100644
--- a/src/captcha/captcha.controller.ts
+++ b/src/captcha/captcha.controller.ts
@@ -48,7 +48,7 @@ export class CaptchaController {
await this.captchaService.validatePIDForCAPTCHA(pid)
- return await this.captchaService.generateCaptcha(theme)
+ return this.captchaService.generateCaptcha(theme)
}
@Post('/verify-manual')
diff --git a/src/captcha/captcha.service.ts b/src/captcha/captcha.service.ts
index f1121c1bd..7bd639f5c 100644
--- a/src/captcha/captcha.service.ts
+++ b/src/captcha/captcha.service.ts
@@ -10,6 +10,7 @@ import * as _includes from 'lodash/includes'
import * as dayjs from 'dayjs'
import * as utc from 'dayjs/plugin/utc'
+import { ProjectService } from 'src/project/project.service'
import { AppLoggerService } from '../logger/logger.service'
import {
isDevelopment,
@@ -17,18 +18,14 @@ import {
REDIS_LOG_CAPTCHA_CACHE_KEY,
isValidPID,
getRedisCaptchaKey,
-} from '../common/constants'
-import { getElValue } from '../analytics/analytics.controller'
-import { ProjectService } from 'src/project/project.service'
-import { GeneratedCaptcha } from './interfaces/generated-captcha'
-import { TokenCaptcha } from './interfaces/token-captcha'
-
-import {
CAPTCHA_SALT,
CAPTCHA_ENCRYPTION_KEY,
CAPTCHA_COOKIE_KEY,
CAPTCHA_TOKEN_LIFETIME,
} from '../common/constants'
+import { getElValue } from '../analytics/analytics.controller'
+import { GeneratedCaptcha } from './interfaces/generated-captcha'
+import { TokenCaptcha } from './interfaces/token-captcha'
dayjs.extend(utc)
diff --git a/src/common/constants.ts b/src/common/constants.ts
index cdb6c499e..5098802ca 100644
--- a/src/common/constants.ts
+++ b/src/common/constants.ts
@@ -153,8 +153,7 @@ const DEFAULT_SELFHOSTED_UUID = 'deadbeef-dead-beef-dead-beefdeadbeef'
const SELFHOSTED_UUID = isSelfhosted ? getSelfhostedUUID() : ''
-const TWO_FACTOR_AUTHENTICATION_APP_NAME =
- process.env.TWO_FACTOR_AUTHENTICATION_APP_NAME
+const { TWO_FACTOR_AUTHENTICATION_APP_NAME } = process.env
const JWT_LIFE_TIME = 7 * 24 * 60 * 60
const HISTORY_LIFE_TIME_DAYS = 30
@@ -182,8 +181,8 @@ const REDIS_PAGEVIEWS_COUNT_KEY = 'stats:pageviews'
const REDIS_PERFORMANCE_COUNT_KEY = 'stats:performance'
// Captcha service
-const CAPTCHA_SALT = process.env.CAPTCHA_SALT
-const CAPTCHA_ENCRYPTION_KEY = process.env.CAPTCHA_ENCRYPTION_KEY
+const { CAPTCHA_SALT } = process.env
+const { CAPTCHA_ENCRYPTION_KEY } = process.env
// 3600 sec -> 1 hour
const redisProjectCacheTimeout = 3600
diff --git a/src/common/guards/bot-detection.guard.ts b/src/common/guards/bot-detection.guard.ts
index 68dac9ce8..90a940134 100644
--- a/src/common/guards/bot-detection.guard.ts
+++ b/src/common/guards/bot-detection.guard.ts
@@ -6,7 +6,7 @@ import {
} from '@nestjs/common'
import { Reflector } from '@nestjs/core'
import * as isbot from 'isbot'
-import { IS_BOT_DETECTION_ENABLED } from '../../common/decorators/bot-detection.decorator'
+import { IS_BOT_DETECTION_ENABLED } from '../decorators/bot-detection.decorator'
@Injectable()
export class BotDetectionGuard implements CanActivate {
diff --git a/src/common/pagination/pagination.ts b/src/common/pagination/pagination.ts
index 51e8ef62b..59e8287ef 100644
--- a/src/common/pagination/pagination.ts
+++ b/src/common/pagination/pagination.ts
@@ -2,7 +2,9 @@ import { PaginationResultInterface } from './pagination.results.interface'
export class Pagination<PaginationEntity> {
public results: PaginationEntity[]
+
public page_total: number
+
public total: number
constructor(paginationResults: PaginationResultInterface<PaginationEntity>) {
diff --git a/src/common/utils.ts b/src/common/utils.ts
index f78fa53f6..ad8761fb3 100644
--- a/src/common/utils.ts
+++ b/src/common/utils.ts
@@ -100,7 +100,7 @@ export const checkRateLimitForApiKey = async (
const getProjectsClickhouse = async (id = null) => {
if (!id) {
const query = 'SELECT * FROM project;'
- return await clickhouse.query(query).toPromise()
+ return clickhouse.query(query).toPromise()
}
const paramsData = {
@@ -136,7 +136,7 @@ const updateProjectClickhouse = async (project: object) => {
', ',
// @ts-ignore
)} WHERE id='${project.id}'`
- return await clickhouse.query(query).toPromise()
+ return clickhouse.query(query).toPromise()
}
/**
@@ -151,9 +151,8 @@ const getPercentageChange = (oldVal: number, newVal: number, round = 2) => {
if (oldVal === 0) {
if (newVal === 0) {
return 0
- } else {
- return _round(-100 * newVal, round)
}
+ return _round(-100 * newVal, round)
}
const decrease = oldVal - newVal
@@ -184,7 +183,7 @@ const calculateRelativePercentage = (
const deleteProjectClickhouse = async id => {
const query = `ALTER table project DELETE WHERE WHERE id='${id}'`
- return await clickhouse.query(query).toPromise()
+ return clickhouse.query(query).toPromise()
}
const createProjectClickhouse = async (project: Project) => {
@@ -196,7 +195,7 @@ const createProjectClickhouse = async (project: Project) => {
const query = `INSERT INTO project (*) VALUES ({id:FixedString(12)},{name:String},'',1,0,'${dayjs
.utc()
.format('YYYY-MM-DD HH:mm:ss')}')`
- return await clickhouse.query(query, paramsData).toPromise()
+ return clickhouse.query(query, paramsData).toPromise()
}
const generateRecoveryCode = () =>
diff --git a/src/mailer/mailer.service.ts b/src/mailer/mailer.service.ts
index e43388442..d60fa21b7 100644
--- a/src/mailer/mailer.service.ts
+++ b/src/mailer/mailer.service.ts
@@ -1,9 +1,9 @@
import { Injectable } from '@nestjs/common'
import * as postmark from 'postmark'
import handlebars from 'handlebars'
-import { LetterTemplate } from './letter'
import fs = require('fs')
import path = require('path')
+import { LetterTemplate } from './letter'
import { AppLoggerService } from '../logger/logger.service'
import { SEND_WARNING_AT_PERC } from '../common/constants'
diff --git a/src/marketplace/categories/categories.controller.spec.ts b/src/marketplace/categories/categories.controller.spec.ts
index d687828f1..20f0d9828 100644
--- a/src/marketplace/categories/categories.controller.spec.ts
+++ b/src/marketplace/categories/categories.controller.spec.ts
@@ -2,11 +2,11 @@ import { Test, TestingModule } from '@nestjs/testing'
import { getRepositoryToken, TypeOrmModule } from '@nestjs/typeorm'
import { UserModule } from 'src/user/user.module'
import { Repository } from 'typeorm'
+import { User } from 'src/user/entities/user.entity'
import { CategoriesController } from './categories.controller'
import { CategoriesService } from './categories.service'
import { Category } from './category.entity'
import { UserService } from '../../user/user.service'
-import { User } from 'src/user/entities/user.entity'
describe('CategoriesController', () => {
let controller: CategoriesController
diff --git a/src/marketplace/categories/categories.controller.ts b/src/marketplace/categories/categories.controller.ts
index 711cb208d..4ce08428d 100644
--- a/src/marketplace/categories/categories.controller.ts
+++ b/src/marketplace/categories/categories.controller.ts
@@ -14,6 +14,7 @@ import {
ValidationPipe,
} from '@nestjs/common'
import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
import { Roles } from '../../auth/decorators/roles.decorator'
import { RolesGuard } from '../../auth/guards/roles.guard'
import { UserType } from '../../user/entities/user.entity'
@@ -27,7 +28,6 @@ import { UpdateCategoryParams } from './dtos/update-category-params.dto'
import { UpdateCategory } from './dtos/update-category.dto'
import { ISaveCategory } from './interfaces/save-category.interface'
import { BodyValidationPipe } from '../common/pipes/body-validation.pipe'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
@ApiTags('categories')
@UsePipes(
@@ -105,7 +105,7 @@ export class CategoriesController {
const categoryInstance = this.categoriesService.create(body)
- return await this.categoriesService.save(categoryInstance)
+ return this.categoriesService.save(categoryInstance)
}
@ApiParam({
diff --git a/src/marketplace/categories/categories.service.spec.ts b/src/marketplace/categories/categories.service.spec.ts
index 9e08f8096..2ec2e89ee 100644
--- a/src/marketplace/categories/categories.service.spec.ts
+++ b/src/marketplace/categories/categories.service.spec.ts
@@ -1,8 +1,8 @@
import { Test, TestingModule } from '@nestjs/testing'
-import { CategoriesService } from './categories.service'
import { Repository } from 'typeorm'
-import { Category } from './category.entity'
import { getRepositoryToken } from '@nestjs/typeorm'
+import { CategoriesService } from './categories.service'
+import { Category } from './category.entity'
describe('CategoriesService', () => {
let service: CategoriesService
diff --git a/src/marketplace/categories/categories.service.ts b/src/marketplace/categories/categories.service.ts
index ecc012abc..ca2ed410b 100644
--- a/src/marketplace/categories/categories.service.ts
+++ b/src/marketplace/categories/categories.service.ts
@@ -14,7 +14,7 @@ export class CategoriesService {
) {}
async findOne(options: FindOneOptions<Category>): Promise<Category> {
- return await this.categoryRepository.findOne({ ...options })
+ return this.categoryRepository.findOne({ ...options })
}
create(category: ICreateCategory): Category {
@@ -22,11 +22,11 @@ export class CategoriesService {
}
async save(category: ISaveCategory): Promise<ISaveCategory & Category> {
- return await this.categoryRepository.save(category)
+ return this.categoryRepository.save(category)
}
async findById(id: number): Promise<Category> {
- return await this.findOne({ where: { id } })
+ return this.findOne({ where: { id } })
}
async update(id: number, category: IUpdateCategory): Promise<void> {
@@ -40,18 +40,18 @@ export class CategoriesService {
async findAndCount(
options: FindManyOptions<Category>,
): Promise<[Category[], number]> {
- return await this.categoryRepository.findAndCount({ ...options })
+ return this.categoryRepository.findAndCount({ ...options })
}
async findByName(name: string): Promise<Category> {
- return await this.findOne({ where: { name }, select: ['name'] })
+ return this.findOne({ where: { name }, select: ['name'] })
}
async findByIds(ids: number[]): Promise<Category[]> {
- return await this.categoryRepository.findByIds(ids)
+ return this.categoryRepository.findByIds(ids)
}
async getCategoryById(id: number) {
- return await this.categoryRepository.findOne({ where: { id } })
+ return this.categoryRepository.findOne({ where: { id } })
}
}
diff --git a/src/marketplace/comments/comments.controller.ts b/src/marketplace/comments/comments.controller.ts
index e7cad2944..a2cda928b 100644
--- a/src/marketplace/comments/comments.controller.ts
+++ b/src/marketplace/comments/comments.controller.ts
@@ -91,7 +91,7 @@ export class CommentsController {
throw new NotFoundException('Comment already exists.')
}
- return await this.commentsService.save({
+ return this.commentsService.save({
...body,
extensionId: Number(body.extensionId),
userId: Number(queries.userId),
diff --git a/src/marketplace/comments/comments.service.ts b/src/marketplace/comments/comments.service.ts
index 18a31b623..8c89b1858 100644
--- a/src/marketplace/comments/comments.service.ts
+++ b/src/marketplace/comments/comments.service.ts
@@ -12,17 +12,17 @@ export class CommentsService {
async findAndCount(
options: FindManyOptions<Comment>,
): Promise<[Comment[], number]> {
- return await this.commentsRepository.findAndCount({ ...options })
+ return this.commentsRepository.findAndCount({ ...options })
}
async findOne(options: FindOneOptions<Comment>): Promise<Comment> {
- return await this.commentsRepository.findOne({ ...options })
+ return this.commentsRepository.findOne({ ...options })
}
async save(
comment: Omit<Comment, 'id' | 'addedAt' | 'extension' | 'user'>,
): Promise<Comment> {
- return await this.commentsRepository.save(comment)
+ return this.commentsRepository.save(comment)
}
async delete(id: string): Promise<void> {
diff --git a/src/marketplace/comments/entities/comment.entity.ts b/src/marketplace/comments/entities/comment.entity.ts
index 5a5c12b13..91f1f8637 100644
--- a/src/marketplace/comments/entities/comment.entity.ts
+++ b/src/marketplace/comments/entities/comment.entity.ts
@@ -1,5 +1,3 @@
-import { Extension } from '../../extensions/entities/extension.entity'
-import { User } from '../../../user/entities/user.entity'
import {
Column,
CreateDateColumn,
@@ -8,6 +6,8 @@ import {
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm'
+import { Extension } from '../../extensions/entities/extension.entity'
+import { User } from '../../../user/entities/user.entity'
@Entity()
export class Comment {
diff --git a/src/marketplace/complaints/complaints.controller.ts b/src/marketplace/complaints/complaints.controller.ts
index 39d3b5ee2..e910d9f45 100644
--- a/src/marketplace/complaints/complaints.controller.ts
+++ b/src/marketplace/complaints/complaints.controller.ts
@@ -9,6 +9,10 @@ import {
Query,
} from '@nestjs/common'
import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'
+import { UserType } from 'src/user/entities/user.entity'
+import { RolesGuard } from 'src/auth/guards/roles.guard'
+import { Roles } from 'src/auth/decorators/roles.decorator'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
import { UserService } from '../../user/user.service'
import { ExtensionsService } from '../extensions/extensions.service'
import { ComplaintsService } from './complaints.service'
@@ -19,10 +23,6 @@ import { ResolveComplaintParamDto } from './dtos/params/resolve-complaint.dto'
import { CreateComplaintQueryDto } from './dtos/queries/create-complaint.dto'
import { GetComplaintsQueryDto } from './dtos/queries/get-complaints.dto'
import { Complaint } from './entities/complaint.entity'
-import { UserType } from 'src/user/entities/user.entity'
-import { RolesGuard } from 'src/auth/guards/roles.guard'
-import { Roles } from 'src/auth/decorators/roles.decorator'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
@ApiTags('complaints')
@Controller('complaints')
diff --git a/src/marketplace/complaints/complaints.service.ts b/src/marketplace/complaints/complaints.service.ts
index 5fb9fe1b9..e5b59201b 100644
--- a/src/marketplace/complaints/complaints.service.ts
+++ b/src/marketplace/complaints/complaints.service.ts
@@ -13,15 +13,15 @@ export class ComplaintsService {
async findAndCount(
options: FindManyOptions<Complaint>,
): Promise<[Complaint[], number]> {
- return await this.complaintsRepository.findAndCount({ ...options })
+ return this.complaintsRepository.findAndCount({ ...options })
}
async findOne(options: FindOneOptions<Complaint>): Promise<Complaint> {
- return await this.complaintsRepository.findOne({ ...options })
+ return this.complaintsRepository.findOne({ ...options })
}
async save(complaint: Partial<Complaint>): Promise<Complaint> {
- return await this.complaintsRepository.save(complaint)
+ return this.complaintsRepository.save(complaint)
}
async update(id: number, complaint: Partial<Complaint>): Promise<void> {
diff --git a/src/marketplace/complaints/entities/complaint.entity.ts b/src/marketplace/complaints/entities/complaint.entity.ts
index c1a7a0528..5701ddcf7 100644
--- a/src/marketplace/complaints/entities/complaint.entity.ts
+++ b/src/marketplace/complaints/entities/complaint.entity.ts
@@ -1,5 +1,3 @@
-import { Extension } from '../../extensions/entities/extension.entity'
-import { User } from '../../../user/entities/user.entity'
import {
Column,
CreateDateColumn,
@@ -8,6 +6,8 @@ import {
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm'
+import { Extension } from '../../extensions/entities/extension.entity'
+import { User } from '../../../user/entities/user.entity'
import { ComplaintStatus } from '../enums/complaint-status.enum'
@Entity()
diff --git a/src/marketplace/extensions/entities/extension-to-project.entity.ts b/src/marketplace/extensions/entities/extension-to-project.entity.ts
index b1a06a0e3..72c61e606 100644
--- a/src/marketplace/extensions/entities/extension-to-project.entity.ts
+++ b/src/marketplace/extensions/entities/extension-to-project.entity.ts
@@ -1,4 +1,3 @@
-import { Project } from '../../../project/entity/project.entity'
import {
Column,
CreateDateColumn,
@@ -7,6 +6,7 @@ import {
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm'
+import { Project } from '../../../project/entity/project.entity'
import { Extension } from './extension.entity'
@Entity()
diff --git a/src/marketplace/extensions/entities/extension-to-user.entity.ts b/src/marketplace/extensions/entities/extension-to-user.entity.ts
index 592053111..cb07da089 100644
--- a/src/marketplace/extensions/entities/extension-to-user.entity.ts
+++ b/src/marketplace/extensions/entities/extension-to-user.entity.ts
@@ -1,4 +1,3 @@
-import { User } from '../../../user/entities/user.entity'
import {
Column,
Entity,
@@ -6,6 +5,7 @@ import {
ManyToOne,
PrimaryGeneratedColumn,
} from 'typeorm'
+import { User } from '../../../user/entities/user.entity'
import { Extension } from './extension.entity'
@Entity()
diff --git a/src/marketplace/extensions/extensions.controller.ts b/src/marketplace/extensions/extensions.controller.ts
index 2b949f628..9fae36e62 100644
--- a/src/marketplace/extensions/extensions.controller.ts
+++ b/src/marketplace/extensions/extensions.controller.ts
@@ -20,6 +20,10 @@ import { ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'
import { getRepository, Like } from 'typeorm'
import * as _map from 'lodash/map'
import * as _size from 'lodash/size'
+import { CurrentUserId } from 'src/auth/decorators/current-user-id.decorator'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
+import { Auth } from 'src/auth/decorators'
+import { FormDataRequest } from 'nestjs-form-data'
import { DeleteExtensionParams } from './dtos/delete-extension-params.dto'
import { GetExtensionParams } from './dtos/get-extension-params.dto'
import { GetAllExtensionsQueries } from './dtos/get-all-extensions-queries.dto'
@@ -30,7 +34,6 @@ import { SearchExtensionQueries } from './dtos/search-extension-queries.dto'
import { CategoriesService } from '../categories/categories.service'
import { SortByExtension } from './enums/sort-by-extension.enum'
import { CdnService } from '../cdn/cdn.service'
-import { CurrentUserId } from 'src/auth/decorators/current-user-id.decorator'
import { Extension } from './entities/extension.entity'
import { GetInstalledExtensionsQueriesDto } from './dtos/queries/get-installed-extensions.dto'
import { InstallExtensionParamsDto } from './dtos/params/install-extension.dto'
@@ -42,14 +45,11 @@ import { Roles } from '../../auth/decorators/roles.decorator'
import { RolesGuard } from '../../auth/guards/roles.guard'
import { UserType } from '../../user/entities/user.entity'
import { ExtensionStatus } from './enums/extension-status.enum'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
-import { Auth } from 'src/auth/decorators'
import {
CreateExtensionBodyDto,
UpdateExtensionBodyDto,
UpdateExtensionParamsDto,
} from './dtos'
-import { FormDataRequest } from 'nestjs-form-data'
@ApiTags('extensions')
@UsePipes(
@@ -400,7 +400,7 @@ export class ExtensionsController {
}
}
- return await this.extensionsService.createExtension({
+ return this.extensionsService.createExtension({
ownerId: userId,
...body,
})
@@ -456,7 +456,7 @@ export class ExtensionsController {
)
}
- return await this.extensionsService.updateExtension(
+ return this.extensionsService.updateExtension(
params.extensionId,
body,
extension.version,
@@ -487,7 +487,7 @@ export class ExtensionsController {
extension.status = ExtensionStatus.ACCEPTED
- return await this.extensionsService.save(extension)
+ return this.extensionsService.save(extension)
}
@ApiParam({
@@ -514,7 +514,7 @@ export class ExtensionsController {
extension.status = ExtensionStatus.REJECTED
- return await this.extensionsService.save(extension)
+ return this.extensionsService.save(extension)
}
@ApiParam({
@@ -573,7 +573,7 @@ export class ExtensionsController {
throw new ConflictException('Extension already installed.')
}
- return await this.extensionsService.createExtensionToUser({
+ return this.extensionsService.createExtensionToUser({
extensionId: extension.id,
userId: user.id,
})
@@ -597,7 +597,7 @@ export class ExtensionsController {
await this.extensionsService.deleteExtensionToUser(extension.id, user.id)
}
- return await this.extensionsService.createExtensionToProject({
+ return this.extensionsService.createExtensionToProject({
extensionId: extension.id,
projectId: project.id,
})
@@ -641,10 +641,7 @@ export class ExtensionsController {
throw new NotFoundException('Extension not installed.')
}
- return await this.extensionsService.deleteExtensionToUser(
- extension.id,
- user.id,
- )
+ return this.extensionsService.deleteExtensionToUser(extension.id, user.id)
}
const project = await this.projectService.findOne(body.projectId)
@@ -665,7 +662,7 @@ export class ExtensionsController {
throw new NotFoundException('Extension not installed.')
}
- return await this.extensionsService.deleteExtensionToProject(
+ return this.extensionsService.deleteExtensionToProject(
extension.id,
project.id,
)
diff --git a/src/marketplace/extensions/extensions.service.ts b/src/marketplace/extensions/extensions.service.ts
index 767671150..fa9abe332 100644
--- a/src/marketplace/extensions/extensions.service.ts
+++ b/src/marketplace/extensions/extensions.service.ts
@@ -2,6 +2,7 @@ import { ForbiddenException, Injectable } from '@nestjs/common'
import * as _pick from 'lodash/pick'
import { InjectRepository } from '@nestjs/typeorm'
import { FindManyOptions, FindOneOptions, Like, Repository } from 'typeorm'
+import { UserService } from 'src/user/user.service'
import { ExtensionToProject } from './entities/extension-to-project.entity'
import { ExtensionToUser } from './entities/extension-to-user.entity'
import { Extension } from './entities/extension.entity'
@@ -12,7 +13,6 @@ import { IUpdateExtension } from './interfaces/update-extension.interface'
import { CreateExtensionType, UpdateExtensionType } from './types'
import { ExtensionStatus } from './enums/extension-status.enum'
import { CdnService } from '../cdn/cdn.service'
-import { UserService } from 'src/user/user.service'
import { ExtensionVersionType } from './dtos'
import { VersionTypes } from './interfaces'
import { SearchExtensionQueries } from './dtos/search-extension-queries.dto'
@@ -34,7 +34,7 @@ export class ExtensionsService {
) {}
async findOne(options: FindOneOptions<Extension>): Promise<Extension> {
- return await this.extensionRepository.findOne({ ...options })
+ return this.extensionRepository.findOne({ ...options })
}
create(extension: ICreateExtension): Extension {
@@ -44,7 +44,7 @@ export class ExtensionsService {
async findOneExtensionToProject(
options: FindOneOptions<ExtensionToProject>,
): Promise<ExtensionToProject> {
- return await this.extensionToProjectRepository.findOne({ ...options })
+ return this.extensionToProjectRepository.findOne({ ...options })
}
async createExtensionToProject(
@@ -52,7 +52,7 @@ export class ExtensionsService {
): Promise<
Pick<ExtensionToProject, 'extensionId' | 'projectId'> & ExtensionToProject
> {
- return await this.extensionToProjectRepository.save(extensionToProject)
+ return this.extensionToProjectRepository.save(extensionToProject)
}
async deleteExtensionToProject(
@@ -66,7 +66,7 @@ export class ExtensionsService {
options: FindManyOptions<ExtensionToProject>,
relations: string[] = [],
): Promise<[ExtensionToProject[], number]> {
- return await this.extensionToProjectRepository.findAndCount({
+ return this.extensionToProjectRepository.findAndCount({
...options,
relations,
})
@@ -76,7 +76,7 @@ export class ExtensionsService {
options: FindManyOptions<ExtensionToUser>,
relations: string[] = [],
): Promise<[ExtensionToUser[], number]> {
- return await this.extensionToUserRepository.findAndCount({
+ return this.extensionToUserRepository.findAndCount({
...options,
relations,
})
@@ -85,7 +85,7 @@ export class ExtensionsService {
async findOneExtensionToUser(
options: FindOneOptions<ExtensionToUser>,
): Promise<ExtensionToUser> {
- return await this.extensionToUserRepository.findOne({ ...options })
+ return this.extensionToUserRepository.findOne({ ...options })
}
async createExtensionToUser(
@@ -93,7 +93,7 @@ export class ExtensionsService {
): Promise<
Pick<ExtensionToUser, 'extensionId' | 'userId'> & ExtensionToUser
> {
- return await this.extensionToUserRepository.save(extensionToUser)
+ return this.extensionToUserRepository.save(extensionToUser)
}
async deleteExtensionToUser(
@@ -152,11 +152,11 @@ export class ExtensionsService {
}
async save(extension: ISaveExtension): Promise<ISaveExtension & Extension> {
- return await this.extensionRepository.save(extension)
+ return this.extensionRepository.save(extension)
}
async findById(id: string): Promise<Extension> {
- return await this.findOne({ where: { id } })
+ return this.findOne({ where: { id } })
}
async update(id: string, extension: IUpdateExtension) {
@@ -171,14 +171,14 @@ export class ExtensionsService {
options: FindManyOptions<Extension>,
relations: string[] = [],
): Promise<[Extension[], number]> {
- return await this.extensionRepository.findAndCount({
+ return this.extensionRepository.findAndCount({
...options,
relations,
})
}
async createExtension(extension: CreateExtensionType) {
- return await this.extensionRepository.save({
+ return this.extensionRepository.save({
owner: { id: extension.ownerId },
name: extension.name,
description: extension.description,
@@ -190,9 +190,7 @@ export class ExtensionsService {
companyLink: extension.companyLink,
mainImage:
extension.mainImage &&
- (
- await this.cdnService.uploadFile(extension.mainImage)
- ).filename,
+ (await this.cdnService.uploadFile(extension.mainImage)).filename,
additionalImages: extension.additionalImages
? [
...(await Promise.all(
@@ -207,9 +205,7 @@ export class ExtensionsService {
: [],
fileURL:
extension.extensionScript &&
- (
- await this.cdnService.uploadFile(extension.extensionScript)
- ).filename,
+ (await this.cdnService.uploadFile(extension.extensionScript)).filename,
version: DEFAULT_EXTENSION_VERSION,
tags: ['New'],
})
@@ -221,12 +217,12 @@ export class ExtensionsService {
if (!user) return null
if (user.roles.includes(UserType.ADMIN)) {
- return await this.extensionRepository.findOne({
+ return this.extensionRepository.findOne({
where: { id: extensionId },
})
}
- return await this.extensionRepository.findOne({
+ return this.extensionRepository.findOne({
where: { id: extensionId, owner: { id: userId } },
})
}
@@ -296,7 +292,7 @@ export class ExtensionsService {
},
)
- return await this.extensionRepository.findOne({
+ return this.extensionRepository.findOne({
where: { id: extensionId },
})
}
@@ -324,7 +320,7 @@ export class ExtensionsService {
}
async searchExtension(data: SearchExtensionQueries) {
- return await this.extensionRepository.findAndCount({
+ return this.extensionRepository.findAndCount({
skip: data.offset || 0,
take: data.limit > 100 ? 100 : data.limit || 10,
where: {
@@ -342,7 +338,7 @@ export class ExtensionsService {
}
async getExtensions(data: GetAllExtensionsQueries) {
- return await this.extensionRepository.findAndCount({
+ return this.extensionRepository.findAndCount({
skip: data.offset || 0,
take: data.limit > 100 ? 100 : data.limit || 10,
where: {
@@ -353,7 +349,7 @@ export class ExtensionsService {
}
async find(options: FindManyOptions<Extension>): Promise<Extension[]> {
- return await this.extensionRepository.find(options)
+ return this.extensionRepository.find(options)
}
async getExtensionInstallCount(
@@ -370,6 +366,6 @@ export class ExtensionsService {
})
}
- return await query.getCount()
+ return query.getCount()
}
}
diff --git a/src/newrelic.ts b/src/newrelic.ts
index 5a92412b1..6fed0ca71 100644
--- a/src/newrelic.ts
+++ b/src/newrelic.ts
@@ -1,5 +1,3 @@
-'use strict'
-
/**
* New Relic agent configuration.
*
diff --git a/src/ping/ping.controller.ts b/src/ping/ping.controller.ts
index 68b8ade64..9f385c75c 100644
--- a/src/ping/ping.controller.ts
+++ b/src/ping/ping.controller.ts
@@ -7,7 +7,5 @@ export class PingController {
constructor() {}
@Get('/')
- async get(): Promise<any> {
- return
- }
+ async get(): Promise<any> {}
}
diff --git a/src/project/entity/project.entity.ts b/src/project/entity/project.entity.ts
index 6838d71b1..b7dd9c736 100644
--- a/src/project/entity/project.entity.ts
+++ b/src/project/entity/project.entity.ts
@@ -8,9 +8,9 @@ import {
} from 'typeorm'
import { ApiProperty } from '@nestjs/swagger'
+import { Alert } from 'src/alert/entity/alert.entity'
import { User } from '../../user/entities/user.entity'
import { ProjectShare } from './project-share.entity'
-import { Alert } from 'src/alert/entity/alert.entity'
import { ExtensionToProject } from '../../marketplace/extensions/entities/extension-to-project.entity'
import { ProjectSubscriber } from './project-subscriber.entity'
import { CAPTCHA_SECRET_KEY_LENGTH } from '../../common/constants'
diff --git a/src/project/project.controller.ts b/src/project/project.controller.ts
index 3f92900cd..7170b7ba9 100644
--- a/src/project/project.controller.ts
+++ b/src/project/project.controller.ts
@@ -26,6 +26,8 @@ import * as _includes from 'lodash/includes'
import * as _omit from 'lodash/omit'
import * as _filter from 'lodash/filter'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
+import { Auth, Public } from 'src/auth/decorators'
import {
ProjectService,
processProjectUser,
@@ -64,8 +66,6 @@ import {
deleteProjectClickhouse,
generateRandomString,
} from '../common/utils'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
-import { Auth, Public } from 'src/auth/decorators'
import {
AddSubscriberParamsDto,
AddSubscriberBodyDto,
@@ -124,32 +124,28 @@ export class ProjectController {
total: _size(formatted),
totalMonthlyEvents: 0, // not needed as it's selfhosed
}
- } else {
- const where = Object()
- where.admin = userId
+ }
+ const where = Object()
+ where.admin = userId
- if (isCaptcha) {
- where.isCaptchaProject = true
- } else {
- where.isAnalyticsProject = true
- }
+ if (isCaptcha) {
+ where.isCaptchaProject = true
+ } else {
+ where.isAnalyticsProject = true
+ }
- const paginated = await this.projectService.paginate(
- { take, skip },
- where,
- )
+ const paginated = await this.projectService.paginate({ take, skip }, where)
- const totalMonthlyEvents = await this.projectService.getRedisCount(userId)
+ const totalMonthlyEvents = await this.projectService.getRedisCount(userId)
- paginated.results = _map(paginated.results, p => ({
- ...p,
- isOwner: true,
- }))
+ paginated.results = _map(paginated.results, p => ({
+ ...p,
+ isOwner: true,
+ }))
- return {
- ...paginated,
- totalMonthlyEvents,
- }
+ return {
+ ...paginated,
+ totalMonthlyEvents,
}
}
@@ -199,7 +195,7 @@ export class ProjectController {
this.logger.log({ take, skip }, 'GET /all')
const where = Object()
- return await this.projectService.paginate({ take, skip }, where)
+ return this.projectService.paginate({ take, skip }, where)
}
@Get('/user/:id')
@@ -348,85 +344,82 @@ export class ProjectController {
await createProjectClickhouse(project)
return project
- } else {
- const user = await this.userService.findOneWithRelations(userId, [
- 'projects',
- ])
- const maxProjects = ACCOUNT_PLANS[user.planCode]?.maxProjects
+ }
+ const user = await this.userService.findOneWithRelations(userId, [
+ 'projects',
+ ])
+ const maxProjects = ACCOUNT_PLANS[user.planCode]?.maxProjects
- if (!user.isActive) {
- throw new ForbiddenException('Please, verify your email address first')
- }
+ if (!user.isActive) {
+ throw new ForbiddenException('Please, verify your email address first')
+ }
- if (user.planCode === PlanCode.none) {
+ if (user.planCode === PlanCode.none) {
+ throw new ForbiddenException(
+ 'You cannot create new projects due to no active subscription. Please upgrade your account plan to continue.',
+ )
+ }
+
+ if (projectDTO.isCaptcha) {
+ if (
+ _size(
+ _filter(
+ user.projects,
+ (project: Project) => project.isCaptchaProject,
+ ) >= (maxProjects || PROJECTS_MAXIMUM),
+ )
+ ) {
throw new ForbiddenException(
- 'You cannot create new projects due to no active subscription. Please upgrade your account plan to continue.',
+ `You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,
)
}
+ } else if (
+ _size(
+ _filter(
+ user.projects,
+ (project: Project) => project.isAnalyticsProject,
+ ) >= (maxProjects || PROJECTS_MAXIMUM),
+ )
+ ) {
+ throw new ForbiddenException(
+ `You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,
+ )
+ }
- if (projectDTO.isCaptcha) {
- if (
- _size(
- _filter(
- user.projects,
- (project: Project) => project.isCaptchaProject,
- ) >= (maxProjects || PROJECTS_MAXIMUM),
- )
- ) {
- throw new ForbiddenException(
- `You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,
- )
- }
- } else {
- if (
- _size(
- _filter(
- user.projects,
- (project: Project) => project.isAnalyticsProject,
- ) >= (maxProjects || PROJECTS_MAXIMUM),
- )
- ) {
- throw new ForbiddenException(
- `You cannot create more than ${maxProjects} projects on your account plan. Please upgrade to be able to create more projects.`,
- )
- }
- }
-
- this.projectService.validateProject(projectDTO)
+ this.projectService.validateProject(projectDTO)
- await this.projectService.checkIfIDUnique(projectDTO.id)
+ await this.projectService.checkIfIDUnique(projectDTO.id)
- try {
- const project = new Project()
- Object.assign(project, projectDTO)
- project.origins = _map(projectDTO.origins, _trim)
+ try {
+ const project = new Project()
+ Object.assign(project, projectDTO)
+ project.origins = _map(projectDTO.origins, _trim)
- if (projectDTO.isCaptcha) {
- project.isCaptchaProject = true
- project.isAnalyticsProject = false
- project.isCaptchaEnabled = true
- project.captchaSecretKey = generateRandomString(
- CAPTCHA_SECRET_KEY_LENGTH,
- )
- }
+ if (projectDTO.isCaptcha) {
+ project.isCaptchaProject = true
+ project.isAnalyticsProject = false
+ project.isCaptchaEnabled = true
+ project.captchaSecretKey = generateRandomString(
+ CAPTCHA_SECRET_KEY_LENGTH,
+ )
+ }
- const newProject = await this.projectService.create(project)
- user.projects.push(project)
+ const newProject = await this.projectService.create(project)
+ user.projects.push(project)
- await this.userService.create(user)
+ await this.userService.create(user)
- return newProject
- } catch (e) {
- if (e.code === 'ER_DUP_ENTRY') {
- if (e.sqlMessage.includes(projectDTO.id)) {
- throw new BadRequestException(
- 'Project with selected ID already exists',
- )
- }
+ return newProject
+ } catch (e) {
+ if (e.code === 'ER_DUP_ENTRY') {
+ if (e.sqlMessage.includes(projectDTO.id)) {
+ throw new BadRequestException(
+ 'Project with selected ID already exists',
+ )
}
-
- throw new BadRequestException(e)
}
+
+ throw new BadRequestException(e)
}
}
@@ -1004,7 +997,7 @@ export class ProjectController {
})
await deleteProjectRedis(share.project.id)
- return await this.projectService.findOneShare(shareId)
+ return this.projectService.findOneShare(shareId)
}
@HttpCode(204)
@@ -1075,7 +1068,7 @@ export class ProjectController {
throw new BadRequestException('Subscriber already exists.')
}
- return await this.projectService.addSubscriber({
+ return this.projectService.addSubscriber({
userId,
projectId: params.projectId,
projectName: project.name,
@@ -1141,7 +1134,7 @@ export class ProjectController {
throw new NotFoundException('Project not found.')
}
- return await this.projectService.getSubscribers(params.projectId, queries)
+ return this.projectService.getSubscribers(params.projectId, queries)
}
@Patch(':projectId/subscribers/:subscriberId')
@@ -1169,7 +1162,7 @@ export class ProjectController {
throw new NotFoundException('Subscriber not found.')
}
- return await this.projectService.updateSubscriber(
+ return this.projectService.updateSubscriber(
params.projectId,
params.subscriberId,
body,
diff --git a/src/project/project.service.ts b/src/project/project.service.ts
index 026f38642..3d1e2908e 100644
--- a/src/project/project.service.ts
+++ b/src/project/project.service.ts
@@ -23,13 +23,16 @@ import * as utc from 'dayjs/plugin/utc'
// @ts-ignore
import * as validateIP from 'validate-ip-node'
+import { UserService } from 'src/user/user.service'
+import { ActionTokensService } from 'src/action-tokens/action-tokens.service'
+import { ActionTokenType } from 'src/action-tokens/action-token.entity'
+import { MailerService } from 'src/mailer/mailer.service'
+import { LetterTemplate } from 'src/mailer/letter'
import { Pagination, PaginationOptionsInterface } from '../common/pagination'
import { Project } from './entity/project.entity'
-import { ProjectShare } from './entity/project-share.entity'
+import { ProjectShare, Role } from './entity/project-share.entity'
import { ProjectDTO } from './dto/project.dto'
import { UserType } from '../user/entities/user.entity'
-import { UserService } from 'src/user/user.service'
-import { Role } from '../project/entity/project-share.entity'
import {
isValidPID,
redisProjectCountCacheTimeout,
@@ -44,10 +47,6 @@ import {
} from '../common/constants'
import { getProjectsClickhouse } from '../common/utils'
import { ProjectSubscriber } from './entity'
-import { ActionTokensService } from 'src/action-tokens/action-tokens.service'
-import { ActionTokenType } from 'src/action-tokens/action-token.entity'
-import { MailerService } from 'src/mailer/mailer.service'
-import { LetterTemplate } from 'src/mailer/letter'
import { AddSubscriberType } from './types'
import { GetSubscribersQueriesDto, UpdateSubscriberBodyDto } from './dto'
import { ReportFrequency } from './enums'
@@ -219,7 +218,7 @@ export class ProjectService {
}
async count(): Promise<number> {
- return await this.projectsRepository.count()
+ return this.projectsRepository.count()
}
async create(project: ProjectDTO | Project): Promise<Project> {
@@ -308,7 +307,6 @@ export class ProjectService {
uid === project.admin?.id ||
_findIndex(project.share, ({ user }) => user?.id === uid) !== -1
) {
- return
} else {
throw new ForbiddenException('You are not allowed to view this project')
}
@@ -328,7 +326,6 @@ export class ProjectService {
share => share.user?.id === uid && share.role === Role.admin,
) !== -1
) {
- return
} else {
throw new ForbiddenException(message)
}
@@ -418,14 +415,13 @@ export class ProjectService {
if (isSelfhosted) {
// selfhosted has no limits
return 0
- } else {
- pids = await this.find({
- where: {
- admin: uid,
- },
- select: ['id'],
- })
}
+ pids = await this.find({
+ where: {
+ admin: uid,
+ },
+ select: ['id'],
+ })
if (_isEmpty(pids)) {
return 0
@@ -495,23 +491,26 @@ export class ProjectService {
}
async getProject(projectId: string, userId: string) {
- return await this.projectsRepository.findOne({
+ return this.projectsRepository.findOne({
where: {
id: projectId,
admin: { id: userId },
},
})
}
+
async getSubscriberByEmail(projectId: string, email: string) {
- return await this.projectSubscriberRepository.findOne({
+ return this.projectSubscriberRepository.findOne({
where: { projectId, email },
})
}
+
async addSubscriber(data: AddSubscriberType) {
const subscriber = await this.projectSubscriberRepository.save({ ...data })
await this.sendSubscriberInvite(data, subscriber.id)
return subscriber
}
+
async sendSubscriberInvite(data: AddSubscriberType, subscriberId: string) {
const { userId, projectId, projectName, email, origin } = data
const actionToken = await this.actionTokens.createActionToken(
@@ -529,16 +528,19 @@ export class ProjectService {
},
)
}
+
async getProjectById(projectId: string) {
- return await this.projectsRepository.findOne({
+ return this.projectsRepository.findOne({
where: { id: projectId },
})
}
+
async getSubscriber(projectId: string, subscriberId: string) {
- return await this.projectSubscriberRepository.findOne({
+ return this.projectSubscriberRepository.findOne({
where: { id: subscriberId, projectId },
})
}
+
async confirmSubscriber(
projectId: string,
subscriberId: string,
@@ -550,6 +552,7 @@ export class ProjectService {
)
await this.actionTokens.deleteActionToken(token)
}
+
async getSubscribers(projectId: string, queries: GetSubscribersQueriesDto) {
const [subscribers, count] =
await this.projectSubscriberRepository.findAndCount({
@@ -559,6 +562,7 @@ export class ProjectService {
})
return { subscribers, count }
}
+
async updateSubscriber(
projectId: string,
subscriberId: string,
@@ -568,20 +572,23 @@ export class ProjectService {
{ id: subscriberId, projectId },
data,
)
- return await this.getSubscriber(projectId, subscriberId)
+ return this.getSubscriber(projectId, subscriberId)
}
+
async removeSubscriber(projectId: string, subscriberId: string) {
await this.projectSubscriberRepository.delete({
id: subscriberId,
projectId,
})
}
+
async getSubscribersForReports(reportFrequency: ReportFrequency) {
- return await this.projectSubscriberRepository.find({
+ return this.projectSubscriberRepository.find({
relations: ['project'],
where: { reportFrequency, isConfirmed: true },
})
}
+
async getSubscriberProjects(subscriberId: string) {
const projects = await this.projectSubscriberRepository.find({
relations: ['project'],
diff --git a/src/task-manager/task-manager.module.ts b/src/task-manager/task-manager.module.ts
index 51c3d2fe2..f1cda7173 100644
--- a/src/task-manager/task-manager.module.ts
+++ b/src/task-manager/task-manager.module.ts
@@ -1,12 +1,12 @@
import { Module, forwardRef } from '@nestjs/common'
+import { AlertModule } from 'src/alert/alert.module'
+import { ExtensionsModule } from 'src/marketplace/extensions/extensions.module'
import { TaskManagerService } from './task-manager.service'
import { MailerModule } from '../mailer/mailer.module'
import { UserModule } from '../user/user.module'
import { ProjectModule } from '../project/project.module'
import { AnalyticsModule } from '../analytics/analytics.module'
import { ActionTokensModule } from '../action-tokens/action-tokens.module'
-import { AlertModule } from 'src/alert/alert.module'
-import { ExtensionsModule } from 'src/marketplace/extensions/extensions.module'
@Module({
imports: [
diff --git a/src/task-manager/task-manager.service.ts b/src/task-manager/task-manager.service.ts
index 7ed07c146..f0b24d9fd 100644
--- a/src/task-manager/task-manager.service.ts
+++ b/src/task-manager/task-manager.service.ts
@@ -12,11 +12,18 @@ import * as _map from 'lodash/map'
import * as _now from 'lodash/now'
import * as _find from 'lodash/find'
+import { AlertService } from 'src/alert/alert.service'
+import { InjectBot } from 'nestjs-telegraf'
+import { TelegrafContext } from 'src/user/user.controller'
+import { Telegraf } from 'telegraf'
+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'
import { MailerService } from '../mailer/mailer.service'
import { UserService } from '../user/user.service'
import { ProjectService } from '../project/project.service'
import { ActionTokensService } from '../action-tokens/action-tokens.service'
-import { AlertService } from 'src/alert/alert.service'
import { ActionTokenType } from '../action-tokens/action-token.entity'
import { LetterTemplate } from '../mailer/letter'
import { AnalyticsService } from '../analytics/analytics.service'
@@ -43,13 +50,6 @@ import {
REDIS_LOG_CAPTCHA_CACHE_KEY,
} from '../common/constants'
import { getRandomTip } from '../common/utils'
-import { InjectBot } from 'nestjs-telegraf'
-import { TelegrafContext } from 'src/user/user.controller'
-import { Telegraf } from 'telegraf'
-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'
dayjs.extend(utc)
diff --git a/src/tg-integration/tg.module.ts b/src/tg-integration/tg.module.ts
index f281dea6c..a0a8bc589 100644
--- a/src/tg-integration/tg.module.ts
+++ b/src/tg-integration/tg.module.ts
@@ -2,8 +2,8 @@ import { Module } from '@nestjs/common'
import { AnalyticsModule } from 'src/analytics/analytics.module'
import { ProjectModule } from 'src/project/project.module'
import { UserModule } from 'src/user/user.module'
-import { SwetrixUpdate } from './tg.update'
import { AlertModule } from 'src/alert/alert.module'
+import { SwetrixUpdate } from './tg.update'
@Module({
imports: [UserModule, ProjectModule, AnalyticsModule, AlertModule],
diff --git a/src/tg-integration/tg.update.ts b/src/tg-integration/tg.update.ts
index 91506a992..1512981c9 100644
--- a/src/tg-integration/tg.update.ts
+++ b/src/tg-integration/tg.update.ts
@@ -53,7 +53,9 @@ export class SwetrixUpdate {
@Ctx() ctx: Context,
@Sender('id') chatId: string,
): Promise<void> {
- const [action, entityId] = ctx.callbackQuery?.['data'].split(':')
+ // TODO: REMOVE THE TS IGNORE AND INVESTIGATE THIS ISSUE
+ // @ts-ignore
+ const [action, entityId] = ctx.callbackQuery?.data.split(':')
if (action === 'unlinkTelegramAccount') {
await ctx.editMessageText(
@@ -73,7 +75,7 @@ export class SwetrixUpdate {
if (!user) {
await ctx.telegram.editMessageText(
ctx.chat.id,
- ctx.callbackQuery?.['message'].message_id,
+ ctx.callbackQuery?.message.message_id,
undefined,
'❌ Your Telegram account is not connected to your Swetrix account.',
)
@@ -87,7 +89,7 @@ export class SwetrixUpdate {
await ctx.telegram.editMessageText(
ctx.chat.id,
- ctx.callbackQuery?.['message'].message_id,
+ ctx.callbackQuery?.message.message_id,
undefined,
'βœ… Your Telegram account is unlinked from your Swetrix account.',
)
@@ -96,7 +98,7 @@ export class SwetrixUpdate {
if (action === 'unlinkTelegramAccountCancel') {
await ctx.telegram.editMessageText(
ctx.chat.id,
- ctx.callbackQuery?.['message'].message_id,
+ ctx.callbackQuery?.message.message_id,
undefined,
'❌ Canceled unlinking of this Telegram account from your Swetrix account.',
)
@@ -105,7 +107,7 @@ export class SwetrixUpdate {
if (action === 'confirmTelegramChatId') {
await ctx.telegram.deleteMessage(
ctx.chat.id,
- ctx.callbackQuery?.['message'].message_id,
+ ctx.callbackQuery?.message.message_id,
)
await ctx.telegram.sendMessage(
ctx.chat.id,
@@ -127,7 +129,7 @@ export class SwetrixUpdate {
if (action === 'cancelTelegramChatId') {
await ctx.telegram.editMessageText(
ctx.chat.id,
- ctx.callbackQuery?.['message'].message_id,
+ ctx.callbackQuery?.message.message_id,
undefined,
'❌ Your Telegram account is not connected to your Swetrix account.',
)
@@ -171,31 +173,30 @@ export class SwetrixUpdate {
const text =
`πŸ“Š *${project.name}*` +
- '\n\n' +
- '*Information*' +
- '\n' +
+ `\n\n` +
+ `*Information*` +
+ `\n` +
`ID: \`${project.id}\`` +
- '\n' +
+ `\n` +
`Active: \`${project.active ? 'yes' : 'no'}\`` +
- '\n' +
+ `\n` +
`Public: \`${project.public ? 'yes' : 'no'}\`` +
- '\n' +
+ `\n` +
`Created: \`${dayjs
.utc(project.created)
.tz(user.timezone)
.format('YYYY-MM-DD HH:mm:ss')}\`` +
- '\n\n' +
- '*Analytics (last 7 days)*' +
- '\n' +
+ `\n\n` +
+ `*Analytics (last 7 days)*` +
+ `\n` +
`Online users: \`${online}\`` +
- '\n' +
+ `\n` +
`Page views: \`${stats[project.id].thisWeek}\`` +
- '\n' +
+ `\n` +
`Unique page views: \`${stats[project.id].thisWeekUnique}\`` +
- '\n\n' +
- '*Alerts*' +
- '\n' +
- alertsString
+ `\n\n` +
+ `*Alerts*` +
+ `\n${alertsString}`
await ctx.editMessageText(text, {
parse_mode: 'Markdown',
reply_markup: {
diff --git a/src/twoFactorAuth/twoFactorAuth.controller.ts b/src/twoFactorAuth/twoFactorAuth.controller.ts
index 876839b31..b2531a97c 100644
--- a/src/twoFactorAuth/twoFactorAuth.controller.ts
+++ b/src/twoFactorAuth/twoFactorAuth.controller.ts
@@ -10,6 +10,7 @@ import {
} from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
import { TwoFactorAuthService } from './twoFactorAuth.service'
import { UserService } from '../user/user.service'
import { AuthService } from '../auth/auth.service'
@@ -24,7 +25,6 @@ import { TwoFaNotRequired } from '../auth/decorators/two-fa-not-required.decorat
import { RolesGuard } from '../auth/guards/roles.guard'
import { TwoFactorAuthDTO } from './dto/2fa-auth.dto'
import { generateRecoveryCode, checkRateLimit } from '../common/utils'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
@ApiTags('2fa')
@Controller('2fa')
@@ -45,9 +45,7 @@ export class TwoFactorAuthController {
async register(@CurrentUserId() id: string) {
const user = await this.userService.findOneWhere({ id })
- return await this.twoFactorAuthService.generateTwoFactorAuthenticationSecret(
- user,
- )
+ return this.twoFactorAuthService.generateTwoFactorAuthenticationSecret(user)
}
@Post('enable')
diff --git a/src/user/user.controller.ts b/src/user/user.controller.ts
index 3144dd51a..3543bc7b3 100644
--- a/src/user/user.controller.ts
+++ b/src/user/user.controller.ts
@@ -29,6 +29,9 @@ import * as _isString from 'lodash/isString'
import * as _omit from 'lodash/omit'
import { v4 as uuidv4 } from 'uuid'
+import { InjectBot } from 'nestjs-telegraf'
+import { Scenes, Telegraf } from 'telegraf'
+import { JwtAccessTokenGuard } from 'src/auth/guards'
import { UserService } from './user.service'
import { ProjectService, deleteProjectRedis } from '../project/project.service'
import {
@@ -62,9 +65,6 @@ import { LetterTemplate } from '../mailer/letter'
import { AppLoggerService } from '../logger/logger.service'
import { UserProfileDTO } from './dto/user.dto'
import { checkRateLimit } from '../common/utils'
-import { InjectBot } from 'nestjs-telegraf'
-import { Scenes, Telegraf } from 'telegraf'
-import { JwtAccessTokenGuard } from 'src/auth/guards'
dayjs.extend(utc)
@@ -126,7 +126,7 @@ export class UserController {
@Query('skip') skip: number | undefined,
): Promise<Pagination<User> | User[]> {
this.logger.log({ take, skip }, 'GET /user')
- return await this.userService.paginate({ take, skip })
+ return this.userService.paginate({ take, skip })
}
@Put('/theme')
@@ -137,7 +137,7 @@ export class UserController {
@CurrentUserId() userId: string,
@Body('theme') theme: Theme,
): Promise<User> {
- return await this.userService.update(userId, { theme })
+ return this.userService.update(userId, { theme })
}
@Get('/search')
@@ -149,7 +149,7 @@ export class UserController {
@Query('query') query: string | undefined,
): Promise<User[]> {
this.logger.log({ query }, 'GET /user/search')
- return await this.userService.search(query)
+ return this.userService.search(query)
}
@Post('/')
diff --git a/src/user/user.service.ts b/src/user/user.service.ts
index 92375ed1e..83ab245c0 100644
--- a/src/user/user.service.ts
+++ b/src/user/user.service.ts
@@ -21,7 +21,7 @@ export class UserService {
) {}
async create(userDTO: UserProfileDTO | User): Promise<User> {
- return await this.usersRepository.save(userDTO)
+ return this.usersRepository.save(userDTO)
}
async paginate(
@@ -61,7 +61,7 @@ export class UserService {
}
async count(): Promise<number> {
- return await this.usersRepository.count()
+ return this.usersRepository.count()
}
omitSensitiveData(user: User): User {
@@ -159,11 +159,11 @@ export class UserService {
}
public async findUser(email: string) {
- return await this.usersRepository.findOne({ email })
+ return this.usersRepository.findOne({ email })
}
public async createUser(user: Pick<User, 'email' | 'password'>) {
- return await this.usersRepository.save({
+ return this.usersRepository.save({
...user,
trialEndDate: dayjs
.utc()
@@ -173,22 +173,22 @@ export class UserService {
}
public async findUserById(id: string) {
- return await this.usersRepository.findOne({ id })
+ return this.usersRepository.findOne({ id })
}
public async updateUser(id: string, user: Partial<Omit<User, 'id'>>) {
- return await this.usersRepository.update({ id }, user)
+ return this.usersRepository.update({ id }, user)
}
public async saveRefreshToken(userId: string, refreshToken: string) {
- return await this.refreshTokenRepository.save({
+ return this.refreshTokenRepository.save({
userId,
refreshToken,
})
}
public async findRefreshToken(userId: string, refreshToken: string) {
- return await this.refreshTokenRepository.findOne({
+ return this.refreshTokenRepository.findOne({
where: {
userId,
refreshToken,
@@ -204,10 +204,10 @@ export class UserService {
}
public async findUserByApiKey(apiKey: string) {
- return await this.usersRepository.findOne({ where: { apiKey } })
+ return this.usersRepository.findOne({ where: { apiKey } })
}
async getUser(id: string) {
- return await this.usersRepository.findOne({ id })
+ return this.usersRepository.findOne({ id })
}
}
diff --git a/src/webhook/webhook.controller.ts b/src/webhook/webhook.controller.ts
index b43a23db9..1d4868443 100644
--- a/src/webhook/webhook.controller.ts
+++ b/src/webhook/webhook.controller.ts
@@ -11,6 +11,7 @@ import {
import { ApiTags } from '@nestjs/swagger'
import * as _find from 'lodash/find'
+import { ProjectService } from 'src/project/project.service'
import {
PlanCode,
ACCOUNT_PLANS,
@@ -18,7 +19,6 @@ import {
} from '../user/entities/user.entity'
import { UserService } from '../user/user.service'
import { AppLoggerService } from '../logger/logger.service'
-import { ProjectService } from 'src/project/project.service'
import { WebhookService } from './webhook.service'
import { SelfhostedGuard } from '../common/guards/selfhosted.guard'
@@ -154,7 +154,5 @@ export class WebhookController {
default:
throw new BadRequestException('Unexpected event type')
}
-
- return
}
}
diff --git a/src/webhook/webhook.module.ts b/src/webhook/webhook.module.ts
index 81b898047..ea4dd3df8 100644
--- a/src/webhook/webhook.module.ts
+++ b/src/webhook/webhook.module.ts
@@ -1,8 +1,8 @@
import { Module, forwardRef } from '@nestjs/common'
+import { ProjectModule } from 'src/project/project.module'
import { WebhookController } from './webhook.controller'
import { UserModule } from '../user/user.module'
-import { ProjectModule } from 'src/project/project.module'
import { AppLoggerModule } from '../logger/logger.module'
import { WebhookService } from './webhook.service'