Stores who follows which users and playlists, and builds the feeds and lists made from it. routes/follows.ts serves the caller's own, and routes/users.ts what any user follows.

Functions

f
followPlaylist(
followerId: string,
playlistId: string
): void

Makes followerId follow a public playlist, and notifies its owner. Following again changes nothing. A follow outlives the playlist going private, but the feeds and lists skip it while it is.

f
followUser(
followerId: string,
followedUserId: string
): void

Makes followerId follow followedUserId, and notifies the followed user. Following again changes nothing. The follower's other tabs are told.

f
getFollowedPlaylistsByUser(
userId: string,
requestingUserId: string | null,
page: number,
limit: number
): Page<Playlist>

Returns a page of the public playlists userId follows, most recently followed first, for their profile and playlists pages. Their dumps are counted for requestingUserId, null being a signed-out viewer.

f
getFollowedPlaylistsDumpFeed(
followerId: string,
page: number,
limit: number,
categoryId?: string
): Page<Dump>

Returns a page of the public dumps in the public playlists followerId follows, optionally only those in categoryId. It feeds the "playlists" half of the index's "followed" tab. A dump in several of them shows once, dated by its latest addition.

f
getFollowedUsersByUser(
userId: string,
page: number,
limit: number
): Page<User>

Returns a page of the users userId follows, most recently followed first, for their profile page. The users carry their password hash and email: pass them through toPublicUser before sending them.

f
getFollowedUsersDumpFeed(
followerId: string,
page: number,
limit: number,
categoryId?: string
): Page<Dump>

Returns a page of the public dumps posted by the users followerId follows, newest first, optionally only those in categoryId. It feeds the "users" half of the index's "followed" tab.

f
getFollowStatus(followerId: string): FollowStatus

Returns the ids of every user and playlist followerId follows, private playlists included, for GET /api/me/follow.

f
unfollowPlaylist(
followerId: string,
playlistId: string
): void

Makes followerId stop following a playlist, if they did.

f
unfollowUser(
followerId: string,
followedUserId: string
): void

Makes followerId stop following followedUserId, if they did.