Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add explicit async and inverse relationship options in test app #285

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/dummy/app/models/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ export default class GroupModel extends Model {
@attr('string')
declare public name: string;

@hasMany('user')
@hasMany('user', { async: true, inverse: 'groups' })
declare public members: DS.PromiseManyArray<UserModel>;

@hasMany('post', {
async: true,
inverse: 'group',
isRealtime: true,

filter(reference: Query) {
Expand Down
5 changes: 3 additions & 2 deletions tests/dummy/app/models/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ export default class PostModel extends Model {
@attr('timestamp')
declare public createdOn: TimestampTransform;

@belongsTo('user')
@belongsTo('user', { async: true, inverse: 'posts' })
declare public author: DS.PromiseObject<UserModel>;

@belongsTo('group')
@belongsTo('group', { async: true, inverse: 'posts' })
declare public group: DS.PromiseObject<GroupModel>;

@belongsTo('user', {
async: true,
inverse: null,

buildReference(db: Firestore) {
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/app/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export default class UserModel extends Model {
@attr('string')
declare public name: string;

@hasMany('group')
@hasMany('group', { async: true, inverse: 'members' })
declare public groups: DS.PromiseManyArray<GroupModel>;

@hasMany('post')
@hasMany('post', { async: true, inverse: 'author' })
declare public posts: DS.PromiseManyArray<PostModel>;
}

Expand Down
Loading