mirror of
https://github.com/outline/outline.git
synced 2026-01-04 10:09:52 -06:00
* fix: Validate team domains are FQDN's Add 10 domain limit per team fix: Deletion of domains not happening within request lifecycle * tests * docs
18 lines
493 B
TypeScript
18 lines
493 B
TypeScript
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");
|
|
}
|
|
},
|
|
},
|
|
});
|
|
}
|