File tree Expand file tree Collapse file tree
endpoints/websocket/entities Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { IsOptional , IsString } from 'class-validator' ;
2- import { MutualExclusiveFields } from 'src/utils/mutual.exclusive.fields .constraint' ;
2+ import { DisallowedFieldCombination } from 'src/utils/disallowed.field.combination .constraint' ;
33import { NoEmptyPayload } from 'src/utils/no.empty.payload.validator' ;
44
55@NoEmptyPayload ( { message : `You must add at least one filter from ${ TransferCustomSubscribePayload . getClassFields ( ) } ` } )
6- @MutualExclusiveFields ( )
6+ @DisallowedFieldCombination ( )
77export class TransferCustomSubscribePayload {
88 @IsOptional ( )
99 @IsString ( )
Original file line number Diff line number Diff line change 66 registerDecorator ,
77} from 'class-validator' ;
88
9- @ValidatorConstraint ( { name : 'mutualExclusiveFields ' , async : false } )
10- export class MutualExclusiveFieldsConstraint
9+ @ValidatorConstraint ( { name : 'disallowedFieldCombination ' , async : false } )
10+ export class DisallowedFieldCombinationConstraint
1111 implements ValidatorConstraintInterface {
1212 validate ( _value : any , args : ValidationArguments ) {
1313 // When used as a class validator, 'value' is usually the instance itself
@@ -59,16 +59,15 @@ export class MutualExclusiveFieldsConstraint
5959 }
6060}
6161
62-
63- export function MutualExclusiveFields ( validationOptions ?: ValidationOptions ) {
62+ export function DisallowedFieldCombination ( validationOptions ?: ValidationOptions ) {
6463 return function ( target : Function ) {
6564 registerDecorator ( {
66- name : 'mutualExclusiveFields ' ,
65+ name : 'disallowedFieldCombination ' ,
6766 target : target as Function ,
6867 propertyName : '' ,
6968 options : validationOptions ,
7069 constraints : [ ] ,
71- validator : MutualExclusiveFieldsConstraint ,
70+ validator : DisallowedFieldCombinationConstraint ,
7271 } ) ;
7372 } ;
7473}
You can’t perform that action at this time.
0 commit comments