cad3b9c746
git-subtree-dir: packages/relations git-subtree-mainline: |
||
---|---|---|
.. | ||
lib | ||
test | ||
.gitignore | ||
.travis.yml | ||
LICENSE | ||
pubspec.yaml | ||
README.md |
relations
Database-agnostic relations between Angel services.
// Authors owning one book
app.service('authors').afterAll(
relations.hasOne('books', as: 'book', foreignKey: 'authorId'));
// Or multiple
app.service('authors').afterAll(
relations.hasMany('books', foreignKey: 'authorId'));
// Or, books belonging to authors
app.service('books').afterAll(relations.belongsTo('authors'));
Supports:
hasOne
hasMany
hasManyThrough
belongsTo
belongsToMany