UNPKG

nestjs-appwrite

Version:

Easier Appwrite integration for your NestJS application.

24 lines (20 loc) 614 B
import typeMetadataStorage from '../../storage/type-metadata.storage'; import { determineRequiredValue, PropOptions } from './prop.options'; export type EmailPropOptions = PropOptions<string> & { isArray?: boolean; }; export function EmailProp(options: EmailPropOptions = {}): PropertyDecorator { return (target, propertyKey) => { const propKey = propertyKey.toString(); typeMetadataStorage.addPropertyMetadata( target.constructor, propKey, { ...options, required: determineRequiredValue(options), type: String, isEmail: true, } ); }; }