49
									
								
								src/models/RunnerCard.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								src/models/RunnerCard.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
 | 
			
		||||
import {
 | 
			
		||||
  IsBoolean,
 | 
			
		||||
  IsInt,
 | 
			
		||||
  IsNotEmpty,
 | 
			
		||||
  IsOptional,
 | 
			
		||||
  IsString,
 | 
			
		||||
} from "class-validator";
 | 
			
		||||
import { Runner } from "./Runner";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Defines a card that can be scanned via a scanner station.
 | 
			
		||||
*/
 | 
			
		||||
@Entity()
 | 
			
		||||
export class RunnerCard {
 | 
			
		||||
  /**
 | 
			
		||||
   * Autogenerated unique id (primary key).
 | 
			
		||||
   */
 | 
			
		||||
  @PrimaryGeneratedColumn()
 | 
			
		||||
  @IsOptional()
 | 
			
		||||
  @IsInt()
 | 
			
		||||
  id: number;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The runner that is currently associated with this card.
 | 
			
		||||
   */
 | 
			
		||||
  @Column()
 | 
			
		||||
  @IsOptional()
 | 
			
		||||
  //TODO: Relation
 | 
			
		||||
  runner: Runner;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * The card's code.
 | 
			
		||||
   * This has to be able to being converted to something barcode compatible.
 | 
			
		||||
   * Probably gonna be autogenerated.
 | 
			
		||||
   */
 | 
			
		||||
  @Column()
 | 
			
		||||
  @IsString()
 | 
			
		||||
  @IsNotEmpty()
 | 
			
		||||
  //TODO: Generate this
 | 
			
		||||
  code: string;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Is the card enabled (for fraud reasons)?
 | 
			
		||||
   */
 | 
			
		||||
  @Column()
 | 
			
		||||
  @IsBoolean()
 | 
			
		||||
  enabled = true;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user