File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,11 +14,24 @@ func (app *ApiServer) v1UsersReposts(c *fiber.Ctx) error {
1414 userId := c .Locals ("userId" )
1515
1616 sql := `
17- SELECT repost_type, repost_item_id, created_at
17+ SELECT repost_type, repost_item_id, reposts. created_at
1818 FROM reposts
19- WHERE user_id = @userId
20- AND is_delete = false
21- ORDER BY created_at DESC
19+ LEFT JOIN tracks
20+ ON repost_type = 'track'
21+ AND repost_item_id = track_id
22+ AND tracks.is_delete = false
23+ AND tracks.is_unlisted = false
24+ AND tracks.is_available = true
25+ LEFT JOIN playlists
26+ ON repost_type != 'track'
27+ AND repost_item_id = playlist_id
28+ AND playlists.is_delete = false
29+ AND playlists.is_private = false
30+ WHERE
31+ user_id = @userId
32+ AND reposts.is_delete = false
33+ AND (tracks.track_id IS NOT NULL OR playlists.playlist_id IS NOT NULL)
34+ ORDER BY reposts.created_at DESC
2235 LIMIT @limit
2336 OFFSET @offset
2437 `
You can’t perform that action at this time.
0 commit comments