feat(legal): add privacy_policy_accepted field to User and enforce on registration#53
Merged
Conversation
… registration Adds two columns to the users table (Flyway V28): privacy_policy_accepted and privacy_policy_accepted_at. RegisterRequest now validates that the client sends acceptedPrivacyPolicy=true (400 otherwise). AuthService sets the flag and timestamp at registration time. UserResponse exposes the field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Qodana for JVM3 new problems were found
View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2025.3.2
with:
upload-result: trueContact Qodana teamContact us at qodana-support@jetbrains.com
|
…l test constructors
…ivacyPolicy in E2E tests ToolExecutionMetric was using Lombok annotations (@Getter, @Setter, @builder) which fail annotation processing under GraalVM/Java 25. Replaced with manual getters, setters, and a static inner Builder following the existing codebase style. E2E register payloads were missing the acceptedPrivacyPolicy field introduced in a recent migration, causing all registration calls to return 400. Added acceptedPrivacyPolicy: true to all affected test payloads in ApplicationE2ETest and AuthE2ETest. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
V28__add_privacy_policy_accepted_to_users.sql): addsprivacy_policy_accepted TINYINT(1) NOT NULL DEFAULT 0andprivacy_policy_accepted_at DATETIME NULLcolumns to theuserstableUserentity: two new fields with getters/settersRegisterRequest: newacceptedPrivacyPolicyfield annotated with@AssertTrue— returns HTTP 400 if the client sendsfalseor omits the fieldAuthService.register(): setsprivacyPolicyAccepted = trueandprivacyPolicyAcceptedAt = now()when a user completes registrationUserResponse: exposesprivacyPolicyAcceptedso the frontend can read the flagAuthMapper: maps the new field from entity to DTOWhy
Google requires every user to actively accept a Privacy Policy before an OAuth2 app can be approved for production. This change persists the acceptance event (boolean + timestamp) for compliance and audit purposes.
Reviewer notes
DEFAULT 0in the migration means all existing users will haveprivacy_policy_accepted = 0. That is intentional — existing users predate this requirement and can be handled separately if needed@AssertTrueconstraint fires during Spring's@Validprocessing on the controller, so no changes are needed in the controller itselfvitorhugo-java/React-JobApplyTracker— PR adds the checkbox UI and sends the flag on registrationTest plan
POST /api/v1/auth/registerwithoutacceptedPrivacyPolicyor withfalse→ HTTP 400 with validation messagePOST /api/v1/auth/registerwithacceptedPrivacyPolicy: true→ HTTP 200, check DB row hasprivacy_policy_accepted = 1and a non-nullprivacy_policy_accepted_atGET /api/v1/auth/mereturnsprivacyPolicyAccepted: truefor newly registered user🤖 Generated with Claude Code