fix: Add 10 domain limit per team (#3733)

* fix: Validate team domains are FQDN's
Add 10 domain limit per team
fix: Deletion of domains not happening within request lifecycle

* tests

* docs
This commit is contained in:
Tom Moor
2022-07-05 21:27:02 +02:00
committed by GitHub
parent 831df67358
commit c36e7bfbb6
5 changed files with 117 additions and 3 deletions

View File

@@ -0,0 +1,17 @@
import { isFQDN } from "class-validator";
import { addAttributeOptions } from "sequelize-typescript";
/**
* A decorator that validates that a string is a fully qualified domain name.
*/
export default function IsFQDN(target: any, propertyName: string) {
return addAttributeOptions(target, propertyName, {
validate: {
validDomain(value: string) {
if (!isFQDN(value)) {
throw new Error("Must be a fully qualified domain name");
}
},
},
});
}