From 2a465f88c58c0b4be3ecd99d96a04c177a40b312 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sat, 16 Jan 2021 17:03:05 +0100 Subject: [PATCH] Removed old create address class ref #105 --- src/models/actions/create/CreateAddress.ts | 69 ---------------------- src/models/entities/Address.ts | 2 +- 2 files changed, 1 insertion(+), 70 deletions(-) delete mode 100644 src/models/actions/create/CreateAddress.ts diff --git a/src/models/actions/create/CreateAddress.ts b/src/models/actions/create/CreateAddress.ts deleted file mode 100644 index 0241301..0000000 --- a/src/models/actions/create/CreateAddress.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { IsNotEmpty, IsOptional, IsPostalCode, IsString } from 'class-validator'; -import { config } from '../../../config'; -import { Address } from '../../entities/Address'; - -/** - * This classed is used to create a new Address entity from a json body (post request). - */ -export class CreateAddress { - /** - * The newaddress's description. - */ - @IsString() - @IsOptional() - description?: string; - - /** - * The new address's first line. - * Containing the street and house number. - */ - @IsString() - @IsNotEmpty() - address1: string; - - /** - * The new address's second line. - * Containing optional information. - */ - @IsString() - @IsOptional() - address2?: string; - - /** - * The new address's postal code. - * This will get checked against the postal code syntax for the configured country. - */ - @IsString() - @IsNotEmpty() - @IsPostalCode(config.postalcode_validation_countrycode) - postalcode: string; - - /** - * The new address's city. - */ - @IsString() - @IsNotEmpty() - city: string; - - /** - * The new address's country. - */ - @IsString() - @IsNotEmpty() - country: string; - - /** - * Creates a new Address entity from this. - */ - public async toEntity(): Promise
{ - let newAddress: Address = new Address(); - - newAddress.address1 = this.address1; - newAddress.address2 = this.address2; - newAddress.postalcode = this.postalcode; - newAddress.city = this.city; - newAddress.country = this.country; - - return newAddress; - } -} \ No newline at end of file diff --git a/src/models/entities/Address.ts b/src/models/entities/Address.ts index d2dd961..ed0d624 100644 --- a/src/models/entities/Address.ts +++ b/src/models/entities/Address.ts @@ -8,7 +8,7 @@ import { Column } from "typeorm"; import { config } from '../../config'; /** - * Defines the Address entity. + * Defines the Address class. * Implemented this way to prevent any formatting differences. */ export class Address {