Skip to content

Ember Data: Fix relationship deprecation warnings #5578

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

Merged
merged 1 commit into from
Dec 3, 2022
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
2 changes: 1 addition & 1 deletion app/models/category.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ export default class Category extends Model {
@attr subcategories;
@attr parent_categories;

@hasMany('crate', { async: true }) crates;
@hasMany('crate', { async: true, inverse: null }) crates;
}
15 changes: 7 additions & 8 deletions app/models/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ export default class Crate extends Model {
@attr documentation;
@attr repository;

@hasMany('versions', { async: true }) versions;

@hasMany('teams', { async: true }) owner_team;
@hasMany('users', { async: true }) owner_user;
@hasMany('version-download', { async: true }) version_downloads;
@hasMany('keywords', { async: true }) keywords;
@hasMany('categories', { async: true }) categories;
@hasMany('dependency', { async: true }) reverse_dependencies;
@hasMany('version', { async: true, inverse: 'crate' }) versions;
@hasMany('team', { async: true, inverse: null }) owner_team;
@hasMany('user', { async: true, inverse: null }) owner_user;
@hasMany('version-download', { async: true, inverse: null }) version_downloads;
@hasMany('keyword', { async: true, inverse: null }) keywords;
@hasMany('category', { async: true, inverse: null }) categories;
@hasMany('dependency', { async: true, inverse: null }) reverse_dependencies;

/**
* This is the default version that will be shown when visiting the crate
Expand Down
2 changes: 1 addition & 1 deletion app/models/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export default class Dependency extends Model {
@attr kind;
@attr downloads;

@belongsTo('version', { async: false }) version;
@belongsTo('version', { async: false, inverse: 'dependencies' }) version;
}
2 changes: 1 addition & 1 deletion app/models/keyword.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default class Keyword extends Model {
@attr('date') created_at;
@attr crates_cnt;

@hasMany('crate', { async: true }) crates;
@hasMany('crate', { async: true, inverse: null }) crates;
}
2 changes: 1 addition & 1 deletion app/models/version-download.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export default class VersionDownload extends Model {
/** @type string */
@attr date;

@belongsTo('version', { async: false }) version;
@belongsTo('version', { async: false, inverse: null }) version;
}
8 changes: 4 additions & 4 deletions app/models/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export default class Version extends Model {
@attr license;
@attr crate_size;

@belongsTo('crate', { async: false }) crate;
@belongsTo('crate', { async: false, inverse: 'versions' }) crate;

@belongsTo('user', { async: false }) published_by;
@hasMany('dependency', { async: true }) dependencies;
@hasMany('version-download', { async: true }) version_downloads;
@belongsTo('user', { async: false, inverse: null }) published_by;
@hasMany('dependency', { async: true, inverse: 'version' }) dependencies;
@hasMany('version-download', { async: true, inverse: null }) version_downloads;

get crateName() {
return this.belongsTo('crate').id();
Expand Down