[DT-4061] Add study ratings and comments - #3052
Open
otchet-broad wants to merge 1 commit into
Open
Conversation
otchet-broad
marked this pull request as ready for review
September 8, 2026 20:44
otchet-broad
requested review from
fboulnois and
rushtong
and removed request for
a team
September 8, 2026 20:44
otchet-broad
force-pushed
the
otchet-dt-4061-study-comments
branch
from
September 8, 2026 21:58
0d6f3c0 to
f16b34c
Compare
otchet-broad
force-pushed
the
otchet-dt-4061-study-pi-details
branch
from
September 8, 2026 21:58
8f0be37 to
dc1f70e
Compare
otchet-broad
force-pushed
the
otchet-dt-4061-study-comments
branch
from
September 9, 2026 13:05
f16b34c to
ff93bf5
Compare
otchet-broad
force-pushed
the
otchet-dt-4061-study-pi-details
branch
2 times, most recently
from
September 9, 2026 14:04
72d3139 to
ab1833b
Compare
otchet-broad
force-pushed
the
otchet-dt-4061-study-comments
branch
from
September 9, 2026 14:04
ff93bf5 to
982f7dd
Compare
Adds a study_comment table and the endpoints behind it: GET/POST
/api/dataset/study/{studyId}/comments and DELETE
/api/dataset/study/{studyId}/comments/{commentId}. The list response
carries the comments plus their average rating.
One comment per user per study, enforced by a unique constraint on
(study_id, user_id), so POST upserts rather than accumulating rows. The
rating is constrained to 1-5 in the database as well as in the service, and
posting requires an active researcher — the Researcher role plus a library
card. Deletes only ever remove the caller's own comment; the user id is
part of the DELETE predicate rather than a check before it.
Reads go through DatasetService#verifyStudyVisibilityAccess, so comments
on a study that is not publicly visible are only readable by its creator,
its custodians, and admins — the same rule the study itself uses.
Entirely additive: a new table, new endpoints, and no change to any
existing response. Nothing in the running UI calls these yet.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
otchet-broad
force-pushed
the
otchet-dt-4061-study-comments
branch
from
September 9, 2026 14:33
982f7dd to
f4d0c37
Compare
otchet-broad
force-pushed
the
otchet-dt-4061-study-pi-details
branch
from
September 9, 2026 14:33
ab1833b to
63e5dd3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base: branch 2 · 17 files, +944 · Migration: yes (1 changeset) · UI impact: none
Adds a
study_commenttable and the endpoints behind it:GET/POST /api/dataset/study/{studyId}/commentsandDELETE /api/dataset/study/{studyId}/comments/{commentId}. The list response carriesthe comments plus their average rating.
One comment per user per study, enforced by a unique constraint on
(study_id, user_id), so POST upserts rather than accumulating rows. Ratingis constrained to 1–5 in the database as well as the service. Posting
requires an active researcher — the Researcher role plus a library card.
Deletes only ever remove the caller's own comment: the user id is part of the
DELETE predicate rather than a check performed before it.
Reads go through
verifyStudyVisibilityAccess, so comments on a study thatis not publicly visible are readable only by its creator, its custodians, and
admins — the same rule the study itself uses.
Entirely additive: new table, new endpoints, no change to any existing
response, and nothing in the running UI calls these yet.
Depends on: branch 1 (visibility gate).
Where this sits in the DT-4061 stack
otchet-dt-3990-study-ratings-pi-detailswas too large to review meaningfully(95 files, +8168), so it was split into eight PRs. This PR targets
otchet-dt-4061-study-pi-details,not
develop, so its diff shows only its own work.otchet-dt-4061-study-visibility-authzdevelopotchet-dt-4061-study-patch-ownershipotchet-dt-4061-study-visibility-authzotchet-dt-4061-study-pi-detailsotchet-dt-4061-study-visibility-authzotchet-dt-4061-study-comments← this PRotchet-dt-4061-study-pi-detailsotchet-dt-4061-study-dar-metricsotchet-dt-4061-study-commentsotchet-dt-4061-study-recommendationsotchet-dt-4061-study-dar-metricsotchet-dt-4061-study-asset-fieldsotchet-dt-4061-study-recommendationsotchet-dt-4061-study-asset-endpointsotchet-dt-4061-study-asset-fieldsBranch 1b is a sibling rather than a link in the chain: nothing depends on it,
so it can be held or dropped without blocking the others. Land the numbered
chain in order — merging out of order, or squash-merging, will require rebasing
the descendants.
The split is verified lossless: branch 7 plus 1b reproduces the original branch
exactly, apart from five
scripts/verify-study-*.shhelper scripts that weredropped at the author's request.
./mvnw test-compilepasses on each branchindependently.
🤖 Generated with Claude Code