feat: Permetti models null

This commit is contained in:
Maicol Battistini 2022-01-26 17:36:56 +01:00
parent 0a62b47b58
commit b579db3f98
1 changed files with 5 additions and 3 deletions

View File

@ -382,9 +382,11 @@ export class RecordsPage extends Page {
data.each((value, field) => {
if (typeof field === 'string' && field.includes(':')) {
const [relation, fieldName] = field.split(':');
const relationModel = this.getRelation(model, relation, true) as IModel;
relationModel[fieldName] = value;
relations[relation] = relationModel;
const relationModel = this.getRelation(model, relation, true);
if (relationModel) {
relationModel[fieldName] = value;
relations[relation] = relationModel;
}
} else {
model[field as string] = value;
}