0
내 nodejs 프로젝트에 ampersand-model-validation-mixin을 사용하고 있습니다. 검증 구문 validateType는 고유 여부 데이터베이스에서 확인 함수앰퍼샌드 모델 유효성 검사 믹스 인이 mysql 쿼리 결과를 기다리지 않습니다.
validations: { 'type': { type: function(){ return validateType(this._values.type); }, msg: 'type cannot be blank and it should be unique' },
이다.
function validateType(type) {if (_.isEmpty(type)) {return false; } else {var searchData = '{"type" : "' + type + '"}';dao.searchDocument(process.env.DEVICE_CONNECTOR_TYPE_MODEL, searchData) .then(function(resp) {if (!_.isEmpty(resp)) {return false;}else{return true;}});}}
그러나 결과를 기다리고 직접 저장하지 않습니다.
어떻게하면 좋을지 생각하십니까 ?? https://github.com/jarredwitt/ampersand-model-validations-mixin/issues/1
그래서 당신은 당신이 이런 종류의 일을 원하는 경우 믹스 인의 기능을 확장 할 필요가 :
"미래 세대"를