Renamed files and classed from *Organisation* to *Organization*📝
ref #117
This commit is contained in:
		
							
								
								
									
										43
									
								
								src/models/actions/create/CreateRunnerOrganization.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/models/actions/create/CreateRunnerOrganization.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| import { IsBoolean, IsObject, IsOptional } from 'class-validator'; | ||||
| import * as uuid from 'uuid'; | ||||
| import { Address } from '../../entities/Address'; | ||||
| import { RunnerOrganization } from '../../entities/RunnerOrganization'; | ||||
| import { CreateRunnerGroup } from './CreateRunnerGroup'; | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * This classed is used to create a new RunnerOrganization entity from a json body (post request). | ||||
|  */ | ||||
| export class CreateRunnerOrganization extends CreateRunnerGroup { | ||||
|     /** | ||||
|      * The new organization's address. | ||||
|      */ | ||||
|     @IsOptional() | ||||
|     @IsObject() | ||||
|     address?: Address; | ||||
|  | ||||
|     /** | ||||
|      * Is registration enabled for the new organization? | ||||
|      */ | ||||
|     @IsOptional() | ||||
|     @IsBoolean() | ||||
|     registrationEnabled?: boolean = false; | ||||
|  | ||||
|     /** | ||||
|      * Creates a new RunnerOrganization entity from this. | ||||
|      */ | ||||
|     public async toEntity(): Promise<RunnerOrganization> { | ||||
|         let newRunnerOrganization: RunnerOrganization = new RunnerOrganization(); | ||||
|  | ||||
|         newRunnerOrganization.name = this.name; | ||||
|         newRunnerOrganization.contact = await this.getContact(); | ||||
|         newRunnerOrganization.address = this.address; | ||||
|         Address.validate(newRunnerOrganization.address); | ||||
|  | ||||
|         if (this.registrationEnabled) { | ||||
|             newRunnerOrganization.key = uuid.v4().toUpperCase(); | ||||
|         } | ||||
|  | ||||
|         return newRunnerOrganization; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user