Skip to content

[DT-4061] Add study ratings and comments - #3052

Open
otchet-broad wants to merge 1 commit into
otchet-dt-4061-study-pi-detailsfrom
otchet-dt-4061-study-comments
Open

[DT-4061] Add study ratings and comments#3052
otchet-broad wants to merge 1 commit into
otchet-dt-4061-study-pi-detailsfrom
otchet-dt-4061-study-comments

Conversation

@otchet-broad

Copy link
Copy Markdown
Contributor

Base: branch 2 · 17 files, +944 · Migration: yes (1 changeset) · UI impact: none

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. Rating
is 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 that
is 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-details was 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.

# Branch Base
1 otchet-dt-4061-study-visibility-authz develop
1b otchet-dt-4061-study-patch-ownership otchet-dt-4061-study-visibility-authz
2 otchet-dt-4061-study-pi-details otchet-dt-4061-study-visibility-authz
3 otchet-dt-4061-study-commentsthis PR otchet-dt-4061-study-pi-details
4 otchet-dt-4061-study-dar-metrics otchet-dt-4061-study-comments
5 otchet-dt-4061-study-recommendations otchet-dt-4061-study-dar-metrics
6 otchet-dt-4061-study-asset-fields otchet-dt-4061-study-recommendations
7 otchet-dt-4061-study-asset-endpoints otchet-dt-4061-study-asset-fields

Branch 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-*.sh helper scripts that were
dropped at the author's request. ./mvnw test-compile passes on each branch
independently.

🤖 Generated with Claude Code

@otchet-broad
otchet-broad marked this pull request as ready for review September 8, 2026 20:44
@otchet-broad
otchet-broad requested a review from a team as a code owner September 8, 2026 20:44
@otchet-broad
otchet-broad requested review from fboulnois and rushtong and removed request for a team September 8, 2026 20:44
@otchet-broad
otchet-broad force-pushed the otchet-dt-4061-study-comments branch from 0d6f3c0 to f16b34c Compare September 8, 2026 21:58
@otchet-broad
otchet-broad force-pushed the otchet-dt-4061-study-pi-details branch from 8f0be37 to dc1f70e Compare September 8, 2026 21:58
@otchet-broad
otchet-broad force-pushed the otchet-dt-4061-study-comments branch from f16b34c to ff93bf5 Compare September 9, 2026 13:05
@otchet-broad
otchet-broad force-pushed the otchet-dt-4061-study-pi-details branch 2 times, most recently from 72d3139 to ab1833b Compare September 9, 2026 14:04
@otchet-broad
otchet-broad force-pushed the otchet-dt-4061-study-comments branch from ff93bf5 to 982f7dd Compare September 9, 2026 14:04
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
otchet-broad force-pushed the otchet-dt-4061-study-comments branch from 982f7dd to f4d0c37 Compare September 9, 2026 14:33
@otchet-broad
otchet-broad force-pushed the otchet-dt-4061-study-pi-details branch from ab1833b to 63e5dd3 Compare September 9, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant