Package su.onno.ui.comments
Class CommentService
java.lang.Object
su.onno.ui.comments.CommentService
Persistence for
onno_comments: the framework-owned thread store behind the
/api/comments endpoint. It is infrastructure (like onno_schema_history), not a
modelled catalog — so it is created with a plain CREATE TABLE IF NOT EXISTS at startup
rather than through the metadata diff engine, and never appears in the navigation or REST model.
A thread is keyed by (entity_type, entity_name, entity_id). Deletes are soft (the row
stays for audit with _deleted = true); reads filter them out.
Timestamps are Instants. They go to and from the plain TIMESTAMP column through
Timestamp (Timestamp.from(instant) on write, getTimestamp().toInstant()
on read), so the instant round-trips symmetrically regardless of the server's zone and no column
migration is needed (#177).
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(String entityType, String entityName, UUID entityId, String authorId, String authorName, String body) Append a comment and return it as stored.add(String entityType, String entityName, UUID entityId, String authorId, String authorName, String body, UUID parentId) Append a top-level comment or a reply and return it as stored.A single comment by id (including soft-deleted ones), for authorization checks.The live thread for one entity, oldest comment first.reactionsFor(Collection<UUID> commentIds, String userKey) Grouped reactions for a batch of comments, preserving first-seen emoji order per comment.booleansoftDelete(UUID id) Soft-delete a comment; returns false when it doesn't exist or was already deleted.booleantoggleReaction(UUID commentId, String userKey, String emoji) Toggle one viewer's reaction on a comment and return whether it is now present.
-
Constructor Details
-
CommentService
public CommentService(org.jdbi.v3.core.Jdbi jdbi)
-
-
Method Details
-
list
The live thread for one entity, oldest comment first. -
add
public Comment add(String entityType, String entityName, UUID entityId, String authorId, String authorName, String body) Append a comment and return it as stored. -
add
public Comment add(String entityType, String entityName, UUID entityId, String authorId, String authorName, String body, UUID parentId) Append a top-level comment or a reply and return it as stored. -
find
A single comment by id (including soft-deleted ones), for authorization checks. -
softDelete
Soft-delete a comment; returns false when it doesn't exist or was already deleted. -
toggleReaction
Toggle one viewer's reaction on a comment and return whether it is now present. -
reactionsFor
public Map<UUID,List<CommentService.CommentReaction>> reactionsFor(Collection<UUID> commentIds, String userKey) Grouped reactions for a batch of comments, preserving first-seen emoji order per comment.
-