Currently the DeepReverseSingleReference field in Sealious has a quite bloated definition:
export default class BlogArticles extends Collection { fields = { // ... categories: new FieldTypes.DeepReverseSingleReference({ intermediary_collection: "article-category", intermediary_field_that_points_here: "article", intermediary_field_that_points_there: "category", target_collection: "article-categories", }),
It's... not pretty. And redundant - the three last arguments in this example can be deduced from the first one in most cases. The constructor for DeepSingleReference should have an alternative constructor where we only pass the intermediary collection name:
export default class BlogArticles extends Collection { fields = { // ... categories: new FieldTypes.DeepReverseSingleReference("article-category"),
It should look into the article-category and deduce the other params from the fields in that collection.
Note that the intermediary collection may have not been initialized yet when the BlogArticles collection is being initialized. We need to do this on start of the application, then.
If it's not possible to unambiguosly assign the proper fields and target collections, throw an error explaining that the user must use the original syntax, with an example of that original syntax.
Update the docs to match the new syntax.