Stores likes on comments and keeps each comment's like_count in step with
them. Likes have no HTTP endpoint to cast or remove. The WebSocket route
(routes/ws.ts) calls this module on comment_like_cast and
comment_like_remove messages, then broadcasts the new count. The comment
routes use it only to list a comment's likers.
Records userId's like on a comment and notifies the comment's author. The
notification is best-effort: if it fails, the like still counts.
Returns a page of the users who like a comment, latest like first, for
GET /api/comments/:commentId/likers. It doesn't check that the caller may
see the comment: the route does that first, with getDump.
Returns the ids of the comments userId likes. The WebSocket route sends
them in its welcome message, and the client shows those like buttons
pressed.
Takes back userId's like on a comment. It doesn't check that the user can
still see the comment, since a like on a dump that has gone private is still
theirs to take back.
Returned to the WebSocket route by castCommentLike and
removeCommentLike. The route acks the liker with likeCount, then
broadcasts it to every client, or to the liker's alone when the comment's
dump isPrivate.
Usage
import * as mod from "api/services/comment-like-service.ts";