Added @property:ImportFormat annotation to id property of UserEntity#1039
Added @property:ImportFormat annotation to id property of UserEntity#1039SzBeni2003 wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughThe pull request adds a single ChangesUser ID Import Format Annotation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt`:
- Around line 90-91: The id field in UserEntity is annotated for import/export
(ImportFormat) despite being `@GeneratedValue`, which lets imported non-zero IDs
overwrite or conflict when CsvParserUtil + repo.saveAll persists; remove or mark
the id as export-only (i.e., stop treating it as an importable field) OR add
validation in the import flow (CsvParserUtil or the service that calls
repo.saveAll) to reject/zero-out any incoming id values unless running in a
privileged "preserve-ids" mode and ensure sequence safety before persisting;
update UserEntity's id ImportFormat usage or add a strict check in the import
path so only new/zero IDs are saved to avoid PK collisions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 56aaf52c-fa4f-4ccb-a172-c1ee66eb9a9c
📒 Files selected for processing (1)
backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt
| @property:ImportFormat | ||
| override var id: Int = 0, |
There was a problem hiding this comment.
Importing generated primary key enables accidental overwrite/collision paths.
id is @GeneratedValue, but this annotation now makes it part of CSV import/export selection. In the current import flow (CsvParserUtil + repo.saveAll), non-zero incoming IDs can map to existing rows and mutate the wrong user or cause PK conflicts. Please gate this (export-only, privileged mode, or strict validation that imported IDs are absent/new and sequence-safe) before persisting.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@backend/src/main/kotlin/hu/bme/sch/cmsch/model/UserEntity.kt` around lines 90
- 91, The id field in UserEntity is annotated for import/export (ImportFormat)
despite being `@GeneratedValue`, which lets imported non-zero IDs overwrite or
conflict when CsvParserUtil + repo.saveAll persists; remove or mark the id as
export-only (i.e., stop treating it as an importable field) OR add validation in
the import flow (CsvParserUtil or the service that calls repo.saveAll) to
reject/zero-out any incoming id values unless running in a privileged
"preserve-ids" mode and ensure sequence safety before persisting; update
UserEntity's id ImportFormat usage or add a strict check in the import path so
only new/zero IDs are saved to avoid PK collisions.
Summary by CodeRabbit