parent
e2cc0c0b80
commit
4c3d2643c1
@ -6,12 +6,19 @@ import { StatsClient } from '../entities/StatsClient';
|
|||||||
*/
|
*/
|
||||||
export class CreateStatsClient {
|
export class CreateStatsClient {
|
||||||
/**
|
/**
|
||||||
* The new clients's description.
|
* The new client's description.
|
||||||
*/
|
*/
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the new client enabled.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
@IsOptional()
|
||||||
|
enabled?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts this to a StatsClient entity.
|
* Converts this to a StatsClient entity.
|
||||||
*/
|
*/
|
||||||
@ -20,6 +27,8 @@ export class CreateStatsClient {
|
|||||||
|
|
||||||
newClient.description = this.description;
|
newClient.description = this.description;
|
||||||
newClient.key = crypto.randomBytes(20).toString('hex');
|
newClient.key = crypto.randomBytes(20).toString('hex');
|
||||||
|
if (this.enabled === undefined || this.enabled === null) { newClient.enabled = true; }
|
||||||
|
else { newClient.enabled = this.enabled }
|
||||||
|
|
||||||
return newClient;
|
return newClient;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { IsInt, IsOptional, IsString } from "class-validator";
|
import { IsBoolean, IsInt, IsOptional, IsString } from "class-validator";
|
||||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||||
/**
|
/**
|
||||||
* Defines the StatsClient entity.
|
* Defines the StatsClient entity.
|
||||||
@ -22,6 +22,14 @@ export class StatsClient {
|
|||||||
@IsString()
|
@IsString()
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the client enabled (for fraud and setup reasons)?
|
||||||
|
* Default: true
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsBoolean()
|
||||||
|
enabled: boolean = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client's api key.
|
* The client's api key.
|
||||||
* This is used to authorize a statsClient against the api.
|
* This is used to authorize a statsClient against the api.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user