Skip to content

feat(status): migrate application status from enum to DB-backed table#54

Merged
vitorhugo-java merged 4 commits into
mainfrom
feat/privacy-policy
Jun 9, 2026
Merged

feat(status): migrate application status from enum to DB-backed table#54
vitorhugo-java merged 4 commits into
mainfrom
feat/privacy-policy

Conversation

@vitorhugo-java

Copy link
Copy Markdown
Owner

Summary

  • DB migration (V29): creates application_statuses table seeded with 9 English values and adds a to_send_later boolean column to job_applications
  • Dynamic status validation: ApplicationService.validateStatus() checks submitted status values against the table and returns HTTP 400 with a helpful message (including the URL to GET /api/v1/applications/statuses) if the value is unknown
  • New endpoint: GET /api/v1/applications/statuses returns the ordered list of valid status strings; protected by hasRole('USER') or hasAuthority('SCOPE_read:applications')
  • MCP tooling: new List-Statuses tool; Create-Application and Update-Application-Status descriptions updated to always call it before setting a status value
  • Entity/service migration: JobApplication, InterviewEvent, repositories, GamificationService, InterviewMetricsService, DashboardService, StaleApplicationsScheduler all migrated from ApplicationStatus enum to plain String; old PT-BR constant names are preserved in set-based checks for backward compatibility with existing records
  • toSendLater field: added to job_applications (DB) and surfaced in ApplicationResponse; existing rows with status IS NULL are backfilled as true
  • All 212 tests pass — integration/e2e/unit tests updated to use new English status values; H2 test DB seeded via data.sql with defer-datasource-initialization: true

What a reviewer should know

  • Existing application records that store old PT-BR status strings (e.g. "Teste Técnico", "GHOSTING") are not touched by the migration — only the new table is created and seeded. The service and gamification logic still recognise old constant names via || checks.
  • The TO_SEND_LATER pseudo-status sent by legacy frontend clients still works (checked in mapRequestToEntity()), but new frontend code should send status: null instead.
  • STATUS_OPTIONS / APPLICATION_STATUSES in the React frontend have been updated to the new English values in a companion commit on the React repo.

Test plan

  • mvn test — 212 passed, 3 skipped (pre-existing), 0 failures
  • GET /api/v1/applications/statuses returns ordered list
  • POST /api/v1/applications with unknown status returns 400 with guidance message
  • POST /api/v1/applications with status: null / applicationDate: null creates a to-send-later draft
  • MCP List-Statuses tool exists and is described correctly

🤖 Generated with Claude Code

vitorhugo-java and others added 4 commits June 8, 2026 20:02
… 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>
…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>
Replaces the hardcoded ApplicationStatus Java enum with a database-backed
`application_statuses` table, enabling dynamic status management without
code deployments.

Key changes:
- Flyway V29: creates application_statuses table seeded with 9 English
  values (RH, Pending HR Response, Pending Hiring Manager Response,
  Technical Test, Pending Technical Test Response, Offer Negotiation,
  Ghosting, Rejected, Approved) and adds `to_send_later` boolean column
- ApplicationStatusEntity + ApplicationStatusRepository for JPA access
- JobApplication/InterviewEvent: status fields changed from enum to String
- ApplicationResponse: new `toSendLater` field
- ApplicationService: added listStatuses(), validateStatus() with 400 on
  unknown values; buildRequest() enforces applicationDate required when
  status is provided
- GET /api/v1/applications/statuses endpoint returns ordered status list
- MCP: new List-Statuses tool; updated Create-Application and
  Update-Application-Status descriptions to always call it first
- GamificationService, InterviewMetricsService, DashboardService,
  StaleApplicationsScheduler: migrated from enum comparisons to String
  checks, retaining backward-compat with old PT-BR constant names
- Tests: updated all integration/e2e/unit tests to use new English status
  values; added data.sql seed + defer-datasource-initialization for H2

All 212 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Qodana for JVM

3 new problems were found

Inspection name Severity Problems
Nullability and data flow problems 🔶 Warning 1
Mismatched query and update of 'StringBuilder' 🔶 Warning 1
Simplifiable conditional expression 🔶 Warning 1
View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/qodana-action@v2025.3.2
        with:
          upload-result: true
Contact Qodana team

Contact us at qodana-support@jetbrains.com

@vitorhugo-java vitorhugo-java merged commit ec975b3 into main Jun 9, 2026
6 checks passed
@vitorhugo-java vitorhugo-java deleted the feat/privacy-policy branch June 9, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant