Skip to content

Commit

Permalink
model reference to non-id index
Browse files Browse the repository at this point in the history
  • Loading branch information
litstat committed Jul 3, 2024
1 parent fe3f615 commit 2be097a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,17 @@ function info(field) {
}

if (property && property.reference) {
m = model(property.reference);
ids = m.idFields;
name = property.property;

// Поле "field" присутствует в исходной модели.
// Пример query: поиск значения в справочнике
return {
field,
model: model(property.reference).aka,
index: 'id',
// inverse: this.aka + '@' + field,
model: m.aka,
index: ids && ids.length === 1 && ids[0] !== name ? name : 'id',
};
}

Expand Down

0 comments on commit 2be097a

Please sign in to comment.