diff --git a/src/models/entities/Address.ts b/src/models/entities/Address.ts index f25b5e8..038f5d6 100644 --- a/src/models/entities/Address.ts +++ b/src/models/entities/Address.ts @@ -5,6 +5,7 @@ import { IsString } from "class-validator"; import { Column } from "typeorm"; +import ValidatorJS from 'validator'; import { config } from '../../config'; /** @@ -62,6 +63,7 @@ export class Address { public static isValidAddress(address: Address): Boolean { if (address == null) { return false; } if (address.address1 == null || address.city == null || address.country == null || address.postalcode == null) { return false; } + if (ValidatorJS.isPostalCode(address.postalcode, config.postalcode_validation_countrycode) == false) { return false; } return true; } }