Hi, I am not completely sure about this, but I think that the generated src/services/servicename/servicename.validate.js should have a quickValidate function that looks like this:
let quickValidate = (method, data, options) => {
try {
if (method === 'create') { validateCreate(options)({ type: 'before', method: 'create', data }); }
if (method === 'update') { validateUpdate(options)({ type: 'before', method: 'update', data }); }
if (method === 'patch') { validatePatch(options)({ type: 'before', method: 'patch', data }); }
} catch (err) {
return err;
}
};
but the generator always create something like this:
let quickValidate = (method, data, options) => {
try {
if (method === 'create') { validateCreate(options)({ type: 'before', method: 'create', data }); }
if (method === 'update') { validateCreate(options)({ type: 'before', method: 'update', data }); }
if (method === 'patch') { validateCreate(options)({ type: 'before', method: 'patch', data }); }
} catch (err) {
return err;
}
};
This way it will always call the validateCreate function no matter what method (create, update or patch) is used.
Are there any open issues that are related to this?
Summary
Hi, I am not completely sure about this, but I think that the generated
src/services/servicename/servicename.validate.js
should have aquickValidate
function that looks like this:but the generator always create something like this:
This way it will always call the
validateCreate
function no matter what method (create
,update
orpatch
) is used.Are there any open issues that are related to this?
none that I have noticed.
Is this PR dependent on PRs in other repos?
no
Other Information
I ran the following commands:
on
test/
,test-expand/
andexamples/
. And also edited:docs/get-started/README.md
generators/writing/templates/src/services/name/name.validate.ejs