1
+ import Model , { attr , hasMany } from '@ember-data/model' ;
1
2
import { map , sort } from '@ember/object/computed' ;
2
- import DS from 'ember-data' ;
3
-
4
- export default DS . Model . extend ( {
5
- name : DS . attr ( 'string' ) ,
6
- downloads : DS . attr ( 'number' ) ,
7
- recent_downloads : DS . attr ( 'number' ) ,
8
- created_at : DS . attr ( 'date' ) ,
9
- updated_at : DS . attr ( 'date' ) ,
10
- max_version : DS . attr ( 'string' ) ,
11
-
12
- description : DS . attr ( 'string' ) ,
13
- homepage : DS . attr ( 'string' ) ,
14
- wiki : DS . attr ( 'string' ) ,
15
- mailing_list : DS . attr ( 'string' ) ,
16
- issues : DS . attr ( 'string' ) ,
17
- documentation : DS . attr ( 'string' ) ,
18
- repository : DS . attr ( 'string' ) ,
19
- exact_match : DS . attr ( 'boolean' ) ,
20
-
21
- versions : DS . hasMany ( 'versions' , { async : true } ) ,
22
- badges : DS . attr ( ) ,
3
+
4
+ export default Model . extend ( {
5
+ name : attr ( 'string' ) ,
6
+ downloads : attr ( 'number' ) ,
7
+ recent_downloads : attr ( 'number' ) ,
8
+ created_at : attr ( 'date' ) ,
9
+ updated_at : attr ( 'date' ) ,
10
+ max_version : attr ( 'string' ) ,
11
+
12
+ description : attr ( 'string' ) ,
13
+ homepage : attr ( 'string' ) ,
14
+ wiki : attr ( 'string' ) ,
15
+ mailing_list : attr ( 'string' ) ,
16
+ issues : attr ( 'string' ) ,
17
+ documentation : attr ( 'string' ) ,
18
+ repository : attr ( 'string' ) ,
19
+ exact_match : attr ( 'boolean' ) ,
20
+
21
+ versions : hasMany ( 'versions' , { async : true } ) ,
22
+ badges : attr ( ) ,
23
23
enhanced_badges : map ( 'badges' , badge => ( {
24
24
...badge ,
25
25
component_name : `badge-${ badge . badge_type } ` ,
@@ -29,13 +29,13 @@ export default DS.Model.extend({
29
29
badge_sort : [ 'badge_type' ] ,
30
30
annotated_badges : sort ( 'enhanced_badges' , 'badge_sort' ) ,
31
31
32
- owners : DS . hasMany ( 'users' , { async : true } ) ,
33
- owner_team : DS . hasMany ( 'teams' , { async : true } ) ,
34
- owner_user : DS . hasMany ( 'users' , { async : true } ) ,
35
- version_downloads : DS . hasMany ( 'version-download' , { async : true } ) ,
36
- keywords : DS . hasMany ( 'keywords' , { async : true } ) ,
37
- categories : DS . hasMany ( 'categories' , { async : true } ) ,
38
- reverse_dependencies : DS . hasMany ( 'dependency' , { async : true } ) ,
32
+ owners : hasMany ( 'users' , { async : true } ) ,
33
+ owner_team : hasMany ( 'teams' , { async : true } ) ,
34
+ owner_user : hasMany ( 'users' , { async : true } ) ,
35
+ version_downloads : hasMany ( 'version-download' , { async : true } ) ,
36
+ keywords : hasMany ( 'keywords' , { async : true } ) ,
37
+ categories : hasMany ( 'categories' , { async : true } ) ,
38
+ reverse_dependencies : hasMany ( 'dependency' , { async : true } ) ,
39
39
40
40
follow ( ) {
41
41
return this . store . adapterFor ( 'crate' ) . follow ( this . id ) ;
0 commit comments