mirror of https://github.com/ghostfolio/ghostfolio
7 changed files with 92 additions and 11 deletions
@ -0,0 +1,18 @@ |
|||
import { |
|||
ValidatorConstraint, |
|||
ValidatorConstraintInterface |
|||
} from 'class-validator'; |
|||
|
|||
import { ghostfolioPrefix } from '../config'; |
|||
import { isValidCustomAssetProfileSymbol } from '../helper'; |
|||
|
|||
@ValidatorConstraint({ name: 'isCustomAssetProfileSymbol' }) |
|||
export class IsCustomAssetProfileSymbolConstraint implements ValidatorConstraintInterface { |
|||
public defaultMessage() { |
|||
return `$property must be a UUID or start with the prefix "${ghostfolioPrefix}_"`; |
|||
} |
|||
|
|||
public validate(aSymbol: string) { |
|||
return isValidCustomAssetProfileSymbol(aSymbol); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue