File tree Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Expand file tree Collapse file tree 2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -28,19 +28,9 @@ export default class Post extends BaseModel {
2828 @hasMany ( ( ) => Comment )
2929 declare comments : HasMany < typeof Comment >
3030
31- @computed ( )
32- get commentsCount ( ) {
33- return this . $extras . comments_count
34- }
35-
3631 @hasMany ( ( ) => Like )
3732 declare likes : HasMany < typeof Like >
3833
39- @computed ( )
40- get likesCount ( ) {
41- return this . $extras . likes_count || 0
42- }
43-
4434 @column . dateTime ( {
4535 autoCreate : true ,
4636 serialize : ( value : DateTime ) => {
@@ -57,4 +47,14 @@ export default class Post extends BaseModel {
5747 } ,
5848 } )
5949 declare updatedAt : DateTime
50+
51+ @computed ( )
52+ get commentsCount ( ) {
53+ return this . $extras . comments_count
54+ }
55+
56+ @computed ( )
57+ get likesCount ( ) {
58+ return this . $extras . likes_count
59+ }
6060}
Original file line number Diff line number Diff line change @@ -85,10 +85,12 @@ export default class User extends compose(BaseModel, AuthFinder) {
8585 get postsCount ( ) {
8686 return this . $extras . posts_count
8787 }
88+
8889 @computed ( )
8990 get followersCount ( ) {
9091 return this . $extras . followers_count
9192 }
93+
9294 @computed ( )
9395 get followingCount ( ) {
9496 return this . $extras . following_count
You can’t perform that action at this time.
0 commit comments