diff --git a/src/models/entities/StatsClient.ts b/src/models/entities/StatsClient.ts new file mode 100644 index 0000000..2c6bf11 --- /dev/null +++ b/src/models/entities/StatsClient.ts @@ -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; +} \ No newline at end of file