This repository has been archived by the owner. It is now read-only.
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@@ -0,0 +1,13 @@ | ||
import {ValidationRule} from 'aurelia-validation'; | ||
import {Entity} from '../index'; | ||
|
||
export class HasAssociationValidationRule extends ValidationRule { | ||
constructor() { | ||
super( | ||
null, | ||
value => !!((value instanceof Entity && typeof value.id === 'number') || typeof value === 'number'), | ||
null, | ||
'isRequired' | ||
); | ||
} | ||
} |