| @@ -1,5 +1,5 @@ | ||||
| import * as argon2 from "argon2"; | ||||
| import { IsBoolean, IsOptional, IsString } from 'class-validator'; | ||||
| import { IsOptional, IsString } from 'class-validator'; | ||||
| import crypto from 'crypto'; | ||||
| import * as uuid from 'uuid'; | ||||
| import { StatsClient } from '../entities/StatsClient'; | ||||
| @@ -15,13 +15,6 @@ export class CreateStatsClient { | ||||
|     @IsOptional() | ||||
|     description?: string; | ||||
|  | ||||
|     /** | ||||
|      * Is the new client enabled. | ||||
|      */ | ||||
|     @IsBoolean() | ||||
|     @IsOptional() | ||||
|     enabled?: boolean; | ||||
|  | ||||
|     /** | ||||
|      * Converts this to a StatsClient entity. | ||||
|      */ | ||||
| @@ -35,9 +28,6 @@ export class CreateStatsClient { | ||||
|         newClient.key = await argon2.hash(newClient.prefix + "." + newUUID); | ||||
|         newClient.cleartextkey = newClient.prefix + "." + newUUID; | ||||
|  | ||||
|         if (this.enabled === undefined || this.enabled === null) { newClient.enabled = true; } | ||||
|         else { newClient.enabled = this.enabled } | ||||
|  | ||||
|         return newClient; | ||||
|     } | ||||
| } | ||||
| @@ -1,4 +1,4 @@ | ||||
| import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator"; | ||||
| import { IsInt, IsOptional, IsString } from "class-validator"; | ||||
| import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; | ||||
| /** | ||||
|  * Defines the StatsClient entity. | ||||
| @@ -22,14 +22,6 @@ export class StatsClient { | ||||
|     @IsString() | ||||
|     description?: string; | ||||
|  | ||||
|     /** | ||||
|      * Is the client enabled (for fraud and setup reasons)? | ||||
|      * Default: true | ||||
|      */ | ||||
|     @Column() | ||||
|     @IsBoolean() | ||||
|     enabled: boolean = true; | ||||
|  | ||||
|     /** | ||||
|      * The client's api key prefix. | ||||
|      * This is used identitfy a client by it's api key. | ||||
|   | ||||
| @@ -1,5 +1,4 @@ | ||||
| import { | ||||
|     IsBoolean, | ||||
|  | ||||
|     IsInt, | ||||
|  | ||||
| @@ -27,12 +26,6 @@ export class ResponseStatsClient { | ||||
|     @IsOptional() | ||||
|     description?: string; | ||||
|  | ||||
|     /** | ||||
|      * Is the client enabled? | ||||
|      */ | ||||
|     @IsBoolean() | ||||
|     enabled: boolean; | ||||
|  | ||||
|     /** | ||||
|      * The client's api key. | ||||
|      * Only visible on creation or regeneration. | ||||
| @@ -55,8 +48,7 @@ export class ResponseStatsClient { | ||||
|     public constructor(client: StatsClient) { | ||||
|         this.id = client.id; | ||||
|         this.description = client.description; | ||||
|         this.enabled = client.enabled; | ||||
|         this.prefix = client.prefix; | ||||
|         this.key = "Only visible on creation/update."; | ||||
|         this.key = "Only visible on creation."; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user