@@ -6,12 +6,19 @@ import { StatsClient } from '../entities/StatsClient';
|
||||
*/
|
||||
export class CreateStatsClient {
|
||||
/**
|
||||
* The new clients's description.
|
||||
* The new client's description.
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* Is the new client enabled.
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
enabled?: boolean;
|
||||
|
||||
/**
|
||||
* Converts this to a StatsClient entity.
|
||||
*/
|
||||
@@ -20,6 +27,8 @@ export class CreateStatsClient {
|
||||
|
||||
newClient.description = this.description;
|
||||
newClient.key = crypto.randomBytes(20).toString('hex');
|
||||
if (this.enabled === undefined || this.enabled === null) { newClient.enabled = true; }
|
||||
else { newClient.enabled = this.enabled }
|
||||
|
||||
return newClient;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user