Skip to content

Commit 5872e3a

Browse files
committed
Auto merge of #2797 - Turbo87:transforms, r=locks
models: Remove unnecessary transforms These are only needed when API fields should be transformed from one type to another (e.g. from ISO8601 string to `Date`), but for the regular cases they don't need to be used. r? `@locks`
2 parents d582909 + f08acb9 commit 5872e3a

File tree

12 files changed

+61
-61
lines changed

12 files changed

+61
-61
lines changed

app/models/api-token.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Model, { attr } from '@ember-data/model';
22

33
export default class ApiToken extends Model {
4-
@attr('string') name;
5-
@attr('string') token;
4+
@attr name;
5+
@attr token;
66
@attr('date') created_at;
77
@attr('date') last_used_at;
88
}

app/models/category-slug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Model, { attr } from '@ember-data/model';
22

33
export default class CategorySlug extends Model {
4-
@attr('string') slug;
5-
@attr('string') description;
4+
@attr slug;
5+
@attr description;
66
}

app/models/category.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import Model, { attr, hasMany } from '@ember-data/model';
22

33
export default class Category extends Model {
4-
@attr('string') category;
5-
@attr('string') slug;
6-
@attr('string') description;
4+
@attr category;
5+
@attr slug;
6+
@attr description;
77
@attr('date') created_at;
8-
@attr('number') crates_cnt;
8+
@attr crates_cnt;
99

10-
@attr() subcategories;
11-
@attr() parent_categories;
10+
@attr subcategories;
11+
@attr parent_categories;
1212

1313
@hasMany('crate', { async: true }) crates;
1414
}

app/models/crate-owner-invite.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Model, { attr } from '@ember-data/model';
22

33
export default class CrateOwnerInvite extends Model {
4-
@attr('string') invited_by_username;
5-
@attr('string') crate_name;
6-
@attr('number') crate_id;
4+
@attr invited_by_username;
5+
@attr crate_name;
6+
@attr crate_id;
77
@attr('date') created_at;
8-
@attr('boolean', { defaultValue: false }) accepted;
8+
@attr accepted;
99
}

app/models/crate.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ import Model, { attr, hasMany } from '@ember-data/model';
33
import { memberAction } from 'ember-api-actions';
44

55
export default class Crate extends Model {
6-
@attr('string') name;
7-
@attr('number') downloads;
8-
@attr('number') recent_downloads;
6+
@attr name;
7+
@attr downloads;
8+
@attr recent_downloads;
99
@attr('date') created_at;
1010
@attr('date') updated_at;
11-
@attr('string') max_version;
12-
@attr('string') newest_version;
13-
14-
@attr('string') description;
15-
@attr('string') homepage;
16-
@attr('string') wiki;
17-
@attr('string') mailing_list;
18-
@attr('string') issues;
19-
@attr('string') documentation;
20-
@attr('string') repository;
21-
@attr('boolean') exact_match;
11+
@attr max_version;
12+
@attr newest_version;
13+
14+
@attr description;
15+
@attr homepage;
16+
@attr wiki;
17+
@attr mailing_list;
18+
@attr issues;
19+
@attr documentation;
20+
@attr repository;
21+
@attr exact_match;
2222

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

app/models/dependency.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import Inflector from 'ember-inflector';
55
Inflector.inflector.irregular('dependency', 'dependencies');
66

77
export default class Dependency extends Model {
8-
@attr('string') crate_id;
9-
@attr('string') req;
10-
@attr('boolean') optional;
11-
@attr('boolean') default_features;
8+
@attr crate_id;
9+
@attr req;
10+
@attr optional;
11+
@attr default_features;
1212
@attr({ defaultValue: () => [] }) features;
13-
@attr('string') kind;
14-
@attr('number') downloads;
13+
@attr kind;
14+
@attr downloads;
1515

1616
@belongsTo('version', { async: false }) version;
1717
}

app/models/keyword.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import Model, { attr, hasMany } from '@ember-data/model';
22

33
export default class Keyword extends Model {
4-
@attr('string') keyword;
4+
@attr keyword;
55
@attr('date') created_at;
6-
@attr('number') crates_cnt;
6+
@attr crates_cnt;
77

88
@hasMany('crate', { async: true }) crates;
99
}

app/models/owned-crate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Model, { attr } from '@ember-data/model';
22

33
export default class OwnedCrate extends Model {
4-
@attr('string') name;
5-
@attr('boolean') email_notifications;
4+
@attr name;
5+
@attr email_notifications;
66
}

app/models/team.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import Model, { attr } from '@ember-data/model';
22
import { computed } from '@ember/object';
33

44
export default class Team extends Model {
5-
@attr('string') email;
6-
@attr('string') name;
7-
@attr('string') login;
8-
@attr('string') api_token;
9-
@attr('string') avatar;
10-
@attr('string') url;
11-
@attr('string') kind;
5+
@attr email;
6+
@attr name;
7+
@attr login;
8+
@attr api_token;
9+
@attr avatar;
10+
@attr url;
11+
@attr kind;
1212

1313
@computed('login', function () {
1414
let login = this.login;

app/models/user.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import Model, { attr } from '@ember-data/model';
33
import { memberAction } from 'ember-api-actions';
44

55
export default class User extends Model {
6-
@attr('string') email;
7-
@attr('boolean') email_verified;
8-
@attr('boolean') email_verification_sent;
9-
@attr('string') name;
10-
@attr('string') login;
11-
@attr('string') avatar;
12-
@attr('string') url;
13-
@attr('string') kind;
6+
@attr email;
7+
@attr email_verified;
8+
@attr email_verification_sent;
9+
@attr name;
10+
@attr login;
11+
@attr avatar;
12+
@attr url;
13+
@attr kind;
1414

1515
stats = memberAction({ type: 'GET', path: 'stats' });
1616
}

app/models/version-download.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Model, { belongsTo, attr } from '@ember-data/model';
22

33
export default class VersionDownload extends Model {
4-
@attr('number') downloads;
4+
@attr downloads;
55
@attr('date') date;
66

77
@belongsTo('version', { async: false }) version;

app/models/version.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { alias } from '@ember/object/computed';
55
import { task } from 'ember-concurrency';
66

77
export default class Version extends Model {
8-
@attr('string') num;
9-
@attr('string') dl_path;
10-
@attr('string') readme_path;
8+
@attr num;
9+
@attr dl_path;
10+
@attr readme_path;
1111
@attr('date') created_at;
1212
@attr('date') updated_at;
13-
@attr('number') downloads;
14-
@attr('boolean') yanked;
15-
@attr('string') license;
16-
@attr('number') crate_size;
13+
@attr downloads;
14+
@attr yanked;
15+
@attr license;
16+
@attr crate_size;
1717

1818
@belongsTo('crate', { async: false }) crate;
1919

0 commit comments

Comments
 (0)