33
									
								
								src/models/entities/StatsClient.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/models/entities/StatsClient.ts
									
									
									
									
									
										Normal file
									
								
							@@ -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;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user