Skip to content

Make patient relationship in CaseEntity optional#24

Merged
mattknatt merged 1 commit into
mainfrom
bugfix/patientId
Mar 31, 2026
Merged

Make patient relationship in CaseEntity optional#24
mattknatt merged 1 commit into
mainfrom
bugfix/patientId

Conversation

@mattknatt

@mattknatt mattknatt commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Cases can now be created and managed without requiring a mandatory patient association, providing greater flexibility in case management workflows.

@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 224db30e-f436-44d3-949e-1c5f7931ae17

📥 Commits

Reviewing files that changed from the base of the PR and between 5a79aca and 72daf57.

📒 Files selected for processing (1)
  • src/main/java/org/example/projektarendehantering/infrastructure/persistence/CaseEntity.java

📝 Walkthrough

Walkthrough

The patient field association in CaseEntity is modified from mandatory to optional by toggling JPA constraint metadata. The @ManyToOne and @JoinColumn annotations are updated to allow null values, enabling Case entities to exist without an associated patient reference.

Changes

Cohort / File(s) Summary
Optional Patient Association
src/main/java/org/example/projektarendehantering/infrastructure/persistence/CaseEntity.java
Changed patient field from mandatory to optional many-to-one relationship by updating @ManyToOne(optional = false)@ManyToOne(optional = true) and @JoinColumn(name = "patient_id", nullable = false)@JoinColumn(name = "patient_id", nullable = true).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A case need not always hold a patient dear,
Now flexibility hops into the code right here!
From rigid bonds to gentle, optional grace,
The bunny cheers—null patients find their place! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/patientId

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mattknatt
mattknatt merged commit 13c3794 into main Mar 31, 2026
1 of 2 checks passed
@mattknatt
mattknatt deleted the bugfix/patientId branch March 31, 2026 13:21
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