54
									
								
								src/models/ScanStation.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/models/ScanStation.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,54 @@
 | 
				
			|||||||
 | 
					import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
 | 
				
			||||||
 | 
					import {
 | 
				
			||||||
 | 
					  IsBoolean,
 | 
				
			||||||
 | 
					  IsInt,
 | 
				
			||||||
 | 
					  IsNotEmpty,
 | 
				
			||||||
 | 
					  IsOptional,
 | 
				
			||||||
 | 
					  IsString,
 | 
				
			||||||
 | 
					} from "class-validator";
 | 
				
			||||||
 | 
					import { Track } from "./Track";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * ScannerStations have the ability to create scans for specific tracks.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					@Entity()
 | 
				
			||||||
 | 
					export class ScanStation {
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * Autogenerated unique id (primary key).
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  @PrimaryGeneratedColumn()
 | 
				
			||||||
 | 
					  @IsOptional()
 | 
				
			||||||
 | 
					  @IsInt()
 | 
				
			||||||
 | 
					  id: number;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * The station's description.
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  @Column()
 | 
				
			||||||
 | 
					  @IsNotEmpty()
 | 
				
			||||||
 | 
					  @IsString()
 | 
				
			||||||
 | 
					  description: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * The track this station is associated with.
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  @Column()
 | 
				
			||||||
 | 
					  @IsNotEmpty()
 | 
				
			||||||
 | 
					  //TODO: Relation
 | 
				
			||||||
 | 
					  track: Track;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * The station's api key.
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  @Column()
 | 
				
			||||||
 | 
					  @IsNotEmpty()
 | 
				
			||||||
 | 
					  @IsString()
 | 
				
			||||||
 | 
					  key: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /**
 | 
				
			||||||
 | 
					   * Is the station enabled (for fraud reasons)?
 | 
				
			||||||
 | 
					   */
 | 
				
			||||||
 | 
					  @Column()
 | 
				
			||||||
 | 
					  @IsBoolean()
 | 
				
			||||||
 | 
					  enabled = true;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user