feat(client): add isWorker condition in hasBusinessType
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
30da0b7ed1
commit
961dc100cc
|
@ -55,13 +55,16 @@ module.exports = Self => {
|
|||
with: /^[\w|.|-]+@[\w|-]+(\.[\w|-]+)*(,[\w|.|-]+@[\w|-]+(\.[\w|-]+)*)*$/
|
||||
});
|
||||
|
||||
Self.validate('businessTypeFk', hasBusinessType, {
|
||||
Self.validateAsync('businessTypeFk', hasBusinessType, {
|
||||
message: `The type of business must be filled in basic data`
|
||||
});
|
||||
|
||||
function hasBusinessType(err) {
|
||||
if (!this.businessTypeFk)
|
||||
async function hasBusinessType(err, done) {
|
||||
const isWorker = await Self.app.models.UserAccount.findById(this.id);
|
||||
|
||||
if (!this.businessTypeFk && !isWorker)
|
||||
err();
|
||||
done();
|
||||
}
|
||||
|
||||
Self.validatesLengthOf('postcode', {
|
||||
|
|
Loading…
Reference in New Issue