fix(basic.gblib): SET PAGED keyword #377.
This commit is contained in:
parent
d18ae6c511
commit
afdb3c86b1
2 changed files with 12 additions and 15 deletions
|
@ -958,12 +958,12 @@ export class DialogKeywords {
|
||||||
result = value;
|
result = value;
|
||||||
} else if (kind === 'name') {
|
} else if (kind === 'name') {
|
||||||
const extractEntity = text => {
|
const extractEntity = text => {
|
||||||
return text.match(/[_a-zA-Z][_a-zA-Z0-9]{0,16}/gi);
|
return text.match(/[_a-zA-Z][_a-zA-Z0-9]{0,30}/gi);
|
||||||
};
|
};
|
||||||
|
|
||||||
const value = extractEntity(answer);
|
const value = extractEntity(answer);
|
||||||
|
|
||||||
if (value === null || value.length != 1) {
|
if (value === null || value.length == 1) {
|
||||||
await this.talk({ pid, text: 'Por favor, digite um nome válido.' });
|
await this.talk({ pid, text: 'Por favor, digite um nome válido.' });
|
||||||
return await this.hear({ pid, kind, args });
|
return await this.hear({ pid, kind, args });
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ export class GBVMService extends GBService {
|
||||||
|
|
||||||
const model = minBoot.core.sequelize.models[t.name];
|
const model = minBoot.core.sequelize.models[t.name];
|
||||||
if (model) {
|
if (model) {
|
||||||
|
|
||||||
// Except Id, checks if has same number of fields.
|
// Except Id, checks if has same number of fields.
|
||||||
|
|
||||||
let equals = 0;
|
let equals = 0;
|
||||||
|
@ -259,32 +259,30 @@ export class GBVMService extends GBService {
|
||||||
let obj1 = t.fields[key];
|
let obj1 = t.fields[key];
|
||||||
let obj2 = model['fieldRawAttributesMap'][key];
|
let obj2 = model['fieldRawAttributesMap'][key];
|
||||||
|
|
||||||
if (key !== "id"){
|
if (key !== "id") {
|
||||||
if (obj1 && obj2)
|
if (obj1 && obj2) {
|
||||||
{
|
|
||||||
equals++;
|
equals++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (equals != Object.keys(t.fields).length) {
|
if (equals != Object.keys(t.fields).length) {
|
||||||
sync = true;
|
sync = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
minBoot.core.sequelize.define(t.name, t.fields);
|
minBoot.core.sequelize.define(t.name, t.fields);
|
||||||
|
|
||||||
// New table checking, if needs sync.
|
// New table checking, if needs sync.
|
||||||
let found = false;
|
let found = false;
|
||||||
tables[0].forEach ((storageTable)=>{
|
tables[0].forEach((storageTable) => {
|
||||||
if (storageTable['table_name'] === t.name)
|
if (storageTable['table_name'] === t.name) {
|
||||||
{
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sync = sync? sync: !found;
|
sync = sync ? sync : !found;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -295,7 +293,7 @@ export class GBVMService extends GBService {
|
||||||
try {
|
try {
|
||||||
from.hasMany(to);
|
from.hasMany(to);
|
||||||
to.belongsTo(from);
|
to.belongsTo(from);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(`BASIC: Invalid relationship in ${mainName}: from ${e.from} to ${e.to} (${min.botId})... ${error.message}`);
|
throw new Error(`BASIC: Invalid relationship in ${mainName}: from ${e.from} to ${e.to} (${min.botId})... ${error.message}`);
|
||||||
}
|
}
|
||||||
|
@ -311,8 +309,7 @@ export class GBVMService extends GBService {
|
||||||
});
|
});
|
||||||
GBLogEx.info(min, `BASIC: Done sync for ${min.botId} storage tables...`);
|
GBLogEx.info(min, `BASIC: Done sync for ${min.botId} storage tables...`);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
GBLogEx.verbose(min, `BASIC: TABLE keywords already up to date (${min.botId})...`);
|
GBLogEx.verbose(min, `BASIC: TABLE keywords already up to date (${min.botId})...`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue