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!

fix linters

Yehor Dremliuhae8fa51f9c312
diff --git a/apps/production/src/project/dto/create-project-view.dto.ts b/apps/production/src/project/dto/create-project-view.dto.ts
index b5e4f7896..3cf832c2c 100644
--- a/apps/production/src/project/dto/create-project-view.dto.ts
+++ b/apps/production/src/project/dto/create-project-view.dto.ts
@@ -7,17 +7,18 @@ import {
MaxLength,
MinLength,
IsLocale,
- IsISO31661Alpha2,
ValidateNested,
+ registerDecorator,
+ ValidationOptions,
+ ValidatorConstraint,
+ ValidatorConstraintInterface,
+ isISO31661Alpha2,
} from 'class-validator'
+
import { ApiProperty } from '@nestjs/swagger'
import { ProjectViewType } from '../entity/project-view.entity'
import { ProjectViewCustomEventMetaValueType } from '../entity/project-view-custom-event.entity'
-import { registerDecorator, ValidationOptions, ValidatorConstraint, ValidatorConstraintInterface } from 'class-validator'
-import { isISO31661Alpha2 } from 'class-validator'
-
-
// This can be updated by the customer request.
// In case we find out that ``cc`` may have any other values, just extend the ``allowedValues`` defined below
// Current implementation is for ``Cloudflare``
@@ -25,9 +26,10 @@ import { isISO31661Alpha2 } from 'class-validator'
const allowedValues = ['T1', 'XX']
@ValidatorConstraint({ async: false })
-export class IsISO31661Alpha2OrCustomConstraint implements ValidatorConstraintInterface {
+export class IsISO31661Alpha2OrCustomConstraint
+ implements ValidatorConstraintInterface
+{
validate(value: any) {
-
return isISO31661Alpha2(value) || allowedValues.includes(value)
}
@@ -36,11 +38,14 @@ export class IsISO31661Alpha2OrCustomConstraint implements ValidatorConstraintIn
}
}
-export function IsISO31661Alpha2OrCustom(validationOptions?: ValidationOptions) {
- return function (object: Object, propertyName: string) {
+export function IsISO31661Alpha2OrCustom(
+ validationOptions?: ValidationOptions,
+) {
+ return function closure(object: object, propertyName: string) {
+ // changed from Object to object
registerDecorator({
target: object.constructor,
- propertyName: propertyName,
+ propertyName,
options: validationOptions,
constraints: [],
validator: IsISO31661Alpha2OrCustomConstraint,
diff --git a/apps/production/src/project/project.service.ts b/apps/production/src/project/project.service.ts
index 7f0f84b29..204457c55 100644
--- a/apps/production/src/project/project.service.ts
+++ b/apps/production/src/project/project.service.ts
@@ -1279,7 +1279,7 @@ export class ProjectService {
async updateProject(id: string, data: Partial<Project>) {
await this.projectsRepository.update({ id }, data)
}
-
+
async findProject(id: string, relations: string[]) {
return this.projectsRepository.findOne({ relations, where: { id } })
}