Create class-transformers package with new decorator EnumFallback. This decorator can be used as follows:
import { EnumFallback } from '@algoan/nestjs-class-transformers';
export enum UserRole {
ADMIN = 'ADMIN',
READER = 'READER',
}
class User {
@EnumFallback({
type: UserRole,
fallback: (value: UserRole) => UserRole.READER // if the role is not "ADMIN" or "READER", then the role will be "READER".
})
public role?: UserRole;
}
Finishes implementation started in #836
Motivation and Context
Fix #834
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Description
Create class-transformers package with new decorator
EnumFallback
. This decorator can be used as follows:Finishes implementation started in #836
Motivation and Context
Fix #834
Types of changes