Skip to content

Conversation

@gunnarvelle
Copy link
Member

Såg noen kommentere at dette hadde vore kjekt, og så var det greit å få til.

@gunnarvelle gunnarvelle requested review from a team and Copilot October 16, 2025 13:04
Copy link

Copilot AI left a 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 parentId field to UpdatedFolderDTO using the UpdateOrDelete type to support setting, deleting, or leaving the parent unchanged
  • Updated FolderConverterService.mergeFolder to handle parent ID changes with proper validation
  • Updated all test cases to include the new required parentId parameter

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.

@Jonas-C
Copy link
Contributor

Jonas-C commented Oct 20, 2025

Burde ikke rank oppdateres ved flytting?

@gunnarvelle
Copy link
Member Author

Burde ikke rank oppdateres ved flytting?

Godt poeng! Ser på det.

@gunnarvelle gunnarvelle requested a review from a team October 23, 2025 10:11
}
}
val rank = if (parentId != existing.parentId) {
0
Copy link
Member Author

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!

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.

4 participants