-
Notifications
You must be signed in to change notification settings - Fork 487
Adding ref_id field to the folder model #2579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a new optional ref_id field to the Folder model (backend), includes a corresponding migration, exposes the field in the Svelte Folder form, and updates folder list view columns to display ref_id. Also updates .gitignore to include .idea. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant F as FolderForm (Svelte)
participant API as Backend API
participant ORM as Django ORM
rect rgba(200,230,255,0.3)
note over U,F: Create/Update Folder with optional ref_id
U->>F: Enter name/description/ref_id
F->>API: POST /folders { name, description, ref_id?, ... }
API->>ORM: save Folder(name, description, ref_id)
ORM-->>API: Folder saved (id, ref_id, ...)
API-->>F: 200 OK { folder }
F-->>U: Show updated list with ref_id column
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.gitignore (1)
22-23
: Normalize Python ignores for reliability and coverageUse directory patterns and include bytecode files to avoid stray artifacts.
-__pycache__ -.idea +__pycache__/ +**/__pycache__/ +*.py[cod] +.ideabackend/iam/migrations/0015_folder_ref_id.py (1)
11-19
: Migration matches model; add index if you index in the modelIf you accept the db_index suggestion, reflect it here to avoid a follow‑up migration.
- field=models.CharField( - blank=True, max_length=100, null=True, verbose_name="reference ID" - ), + field=models.CharField( + blank=True, max_length=100, null=True, db_index=True, verbose_name="reference ID" + ),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.gitignore
(1 hunks)backend/iam/migrations/0015_folder_ref_id.py
(1 hunks)backend/iam/models.py
(1 hunks)frontend/src/lib/components/Forms/ModelForm/FolderForm.svelte
(2 hunks)frontend/src/lib/utils/table.ts
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
backend/iam/models.py (1)
backend/ebios_rm/models.py (1)
ref_id
(900-901)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: build_community_frontend
- GitHub Check: build_enterprise_frontend
- GitHub Check: test (3.12)
- GitHub Check: enterprise-startup-docker-compose-test
- GitHub Check: startup-docker-compose-test
- GitHub Check: startup-functional-test (3.12)
- GitHub Check: enterprise-startup-functional-test (3.12)
- GitHub Check: Analyze (python)
🔇 Additional comments (4)
frontend/src/lib/components/Forms/ModelForm/FolderForm.svelte (2)
7-7
: LGTM: Needed import added and usedImport is correct and utilized below.
33-34
: Enforce ref_id maxlength=100 in UIMirror backend max_length=100 to avoid server-side validation failures — TextField forwards arbitrary props via {...rest}, and m.refId exists in frontend/messages/*.json.
-<TextField {form} field="ref_id" label={m.refId()} /> +<TextField {form} field="ref_id" label={m.refId()} maxLength={100} />backend/iam/models.py (1)
105-107
: Index ref_id for faster lists/search; consider serializer coverageFolders are listed with ref_id and will likely be filtered/sorted. Add a DB index. Also ensure serializers expose ref_id so the UI column populates.
- ref_id = models.CharField( - max_length=100, blank=True, null=True, verbose_name=_("reference ID") - ) + ref_id = models.CharField( + max_length=100, + blank=True, + null=True, + db_index=True, + verbose_name=_("reference ID"), + )Run to verify serializers expose
ref_id
(allowing for either explicitfields
or__all__
):frontend/src/lib/utils/table.ts (1)
936-938
: LGTM: Add ref_id to folder list columnsConsistent with backend and other list views that prioritize ref_id. Ensure API returns ref_id for folders.
Adding the field ref_id to the folder models and making sure it shows up on both add/edit forms and detailsview of a folder
Summary by CodeRabbit
New Features
Chores