fallo validateasync
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-01-27 09:14:37 +01:00
parent 3026ca8d69
commit 4b302915b5
1 changed files with 4 additions and 3 deletions

View File

@ -15,9 +15,10 @@ module.exports = function(Self) {
message: 'Company has to be official' message: 'Company has to be official'
}); });
async function isOfficialCompany(value) { async function isOfficialCompany(err, done) {
const company = await Self.app.models.Company.findById(value); const hasCompany = await Self.app.models.Company.exists(this.companyFk);
return company.isOfficial; if (!hasCompany) err();
done();
} }
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {