BC-10770 - update secondarySchools of guest teachers when a room is deleted#6073
Open
sebmue-dataport wants to merge 17 commits intomainfrom
Open
BC-10770 - update secondarySchools of guest teachers when a room is deleted#6073sebmue-dataport wants to merge 17 commits intomainfrom
sebmue-dataport wants to merge 17 commits intomainfrom
Conversation
hoeppner-dataport
requested changes
Feb 4, 2026
| export class Migration20260130082056 extends Migration { | ||
| public async up(): Promise<void> { | ||
| const usersToUpdate = await this.getCollection('users') | ||
| .aggregate<UserWithSecondarySchools>([ |
Contributor
There was a problem hiding this comment.
After:
- seeding my database
- adding a teacher to a room of another school and
- executing the aggregation
I get a result that contains this teachers secondary school being removed... which is wrong.
Reason for this is that secondarySchools not only contains schoolIds, but also roleIds to differentiate which guest-role the person has at that school.
$setDifference: ['$secondarySchools', '$activeSecondarySchools'], will therefore always contain all secondarySchools.
The query needs to be adapted to not include valid entries for secondarySchool.
Also the update would write only schoolIds into the secondarySchools field... but the roles should be untouched.
…hpi-schul-cloud/schulcloud-server into bc-10770-clear-secondaryschools
|
hoeppner-dataport
approved these changes
Feb 6, 2026
| export class Migration20260130082056 extends Migration { | ||
| public async up(): Promise<void> { | ||
| const usersToUpdate = await this.getCollection('users') | ||
| .aggregate<UserWithSecondarySchools>([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Guest teachers who are invited to rooms on different schools have the school id added to their list of secondary schools. When removing a guest teacher from a room that list was updated correctly (removing the school id). When deleting the room that did not happen.
Links to Tickets or other pull requests
BC-10770
Changes
Approval for review
generate-client:serverwas executed in vue frontend and changes were tested and put in a PR with the same branch name.