Skip to content

Commit ef4747a

Browse files
committed
Repaired profiles controller
1 parent 8e7717b commit ef4747a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

app/controllers/Profiles/main.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ export default class ProfilesController {
99
const user = await User.query()
1010
.where({ username })
1111
.preload('avatar')
12-
.preload('posts')
13-
.preload('likes')
12+
.preload('posts', (postsQuery: any) => {
13+
postsQuery.preload('media')
14+
postsQuery.withCount('likes')
15+
postsQuery.withCount('comments')
16+
})
1417
.preload('followers')
1518
.preload('following')
1619
.withCount('posts')
17-
.withCount('likes')
1820
.withCount('followers')
1921
.withCount('following')
2022
.firstOrFail()

0 commit comments

Comments
 (0)