Last active
March 1, 2018 19:22
-
-
Save FelipeBarrosCruz/3cecab82bbe730d75ea7e3201882dcae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Plugin () { | |
const seneca = this | |
const MergeValidate = require('btime-merge-validate-package') | |
const mergeValidate = MergeValidate(seneca) | |
const PICK_FIELDS = [ | |
'field' | |
] | |
seneca.add({ role: 'plugin', cmd: 'create' }, cmd_create) | |
function cmd_create (args, done) { | |
mergeValidate.validate({ | |
args, | |
pick: PICK_FIELDS, | |
schema: getValidateSchema(), | |
options: { abortEarly: false } | |
}) | |
.then(params => create(params)) | |
.then(result => done(null, result)) | |
.catch(err => done(null, err)) | |
} | |
function createService(params) { | |
return new Promise((resolve, reject) => { | |
return reject({ status: false, message: 'Error' }) | |
return resolve({ status: true, result: {} }) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment