-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for moving folder #788
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: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds support for moving folders within the folder hierarchy by introducing a new parentId field to the UpdatedFolderDTO API model. This allows users to update a folder's parent, enabling folder relocation functionality.
Key Changes:
- Added
parentIdfield toUpdatedFolderDTOusing theUpdateOrDeletetype to support setting, deleting, or leaving the parent unchanged - Updated
FolderConverterService.mergeFolderto handle parent ID changes with proper validation - Updated all test cases to include the new required
parentIdparameter
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| myndla-api/src/main/scala/no/ndla/myndlaapi/model/api/FolderDTO.scala | Added parentId field to UpdatedFolderDTO API model |
| myndla-api/src/main/scala/no/ndla/myndlaapi/service/FolderConverterService.scala | Implemented parent ID update logic with validation in mergeFolder method |
| myndla-api/src/test/scala/no/ndla/myndlaapi/service/FolderConverterServiceTest.scala | Added test cases for moving folders to new parents and removing parents |
| myndla-api/src/test/scala/no/ndla/myndlaapi/service/FolderWriteServiceTest.scala | Updated existing test cases to include the new parentId parameter |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
myndla-api/src/main/scala/no/ndla/myndlaapi/service/FolderConverterService.scala
Show resolved
Hide resolved
myndla-api/src/test/scala/no/ndla/myndlaapi/service/FolderConverterServiceTest.scala
Outdated
Show resolved
Hide resolved
|
Burde ikke rank oppdateres ved flytting? |
Godt poeng! Ser på det. |
myndla-api/src/main/scala/no/ndla/myndlaapi/service/FolderConverterService.scala
Show resolved
Hide resolved
8ad2846 to
9f8519b
Compare
myndla-api/src/test/scala/no/ndla/myndlaapi/service/FolderWriteServiceTest.scala
Show resolved
Hide resolved
0437e26 to
eadb511
Compare
| } | ||
| } | ||
| val rank = if (parentId != existing.parentId) { | ||
| 0 |
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.
Setter rank til 0 ved flytting som fører til at ny plassering er først i ny mappe. Diskuter!
0a1be1b to
9602a08
Compare
9602a08 to
1e49b20
Compare
Såg noen kommentere at dette hadde vore kjekt, og så var det greit å få til.