parent
63b8176bdf
commit
a738c19316
|
@ -0,0 +1,33 @@
|
|||
import { IsInt, IsOptional, IsString } from "class-validator";
|
||||
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
||||
/**
|
||||
* Defines the StatsClient entity.
|
||||
* StatsClients can be used to access the protected parts of the stats api (top runners, donators and so on).
|
||||
*/
|
||||
@Entity()
|
||||
export abstract class StatsClient {
|
||||
/**
|
||||
* Autogenerated unique id (primary key).
|
||||
*/
|
||||
@PrimaryGeneratedColumn()
|
||||
@IsInt()
|
||||
id: number;
|
||||
|
||||
/**
|
||||
* The clients's description.
|
||||
* Mostly for better UX when traceing back stuff.
|
||||
*/
|
||||
@Column({ nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
* The client's api key.
|
||||
* This is used to authorize a statsClient against the api.
|
||||
* It only grants access to the /stats/** routes.
|
||||
*/
|
||||
@Column()
|
||||
@IsString()
|
||||
key: string;
|
||||
}
|
Loading…
Reference in New Issue