2019-06-20 10:24:23 +00:00
|
|
|
import { interfaces } from './interfaces'
|
2019-06-29 09:02:30 +00:00
|
|
|
import { METADATA_KEY } from './constants'
|
2019-06-20 10:24:23 +00:00
|
|
|
|
|
|
|
function getVaildControllerMetadata(model: Object) {
|
|
|
|
let controllerMetadata: interfaces.MethodMetadata = Reflect.getMetadata(
|
|
|
|
METADATA_KEY.vaildController,
|
|
|
|
model
|
|
|
|
) || {};
|
|
|
|
return controllerMetadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getVaildMethodMetadata(constructor: any) {
|
|
|
|
let parameterMetadata: interfaces.ParameterMetadata[] = Reflect.getMetadata(
|
|
|
|
METADATA_KEY.vaildMethod,
|
|
|
|
constructor
|
|
|
|
) || [];
|
|
|
|
return parameterMetadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getVaildModelMetadata(model: Object) {
|
|
|
|
let propertyMetadata: interfaces.PropertyMetadata[] = Reflect.getMetadata(
|
|
|
|
METADATA_KEY.vaildModel,
|
|
|
|
model
|
|
|
|
) || [];
|
|
|
|
return propertyMetadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
getVaildControllerMetadata,
|
|
|
|
getVaildMethodMetadata,
|
|
|
|
getVaildModelMetadata
|
|
|
|
}
|