-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
N21 2202 fix shd school data cannot be updated (#5261)
* update school rule * migration: Migration20240925165112 --------- Co-authored-by: Alexander Weber <[email protected]>
- Loading branch information
1 parent
5be1238
commit a6b710f
Showing
6 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
apps/server/src/migrations/mikro-orm/Migration20240925165112.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Migration } from '@mikro-orm/migrations-mongodb'; | ||
|
||
export class Migration20240925165112 extends Migration { | ||
async up(): Promise<void> { | ||
const adminRoleUpdate = await this.getCollection('roles').updateOne( | ||
{ name: 'superhero' }, | ||
{ | ||
$addToSet: { | ||
permissions: { | ||
$each: ['SCHOOL_EDIT_ALL'], | ||
}, | ||
}, | ||
} | ||
); | ||
|
||
if (adminRoleUpdate.modifiedCount > 0) { | ||
console.info('Permission SCHOOL_EDIT_ALL added to role superhero.'); | ||
} | ||
} | ||
|
||
async down(): Promise<void> { | ||
const adminRoleUpdate = await this.getCollection('roles').updateOne( | ||
{ name: 'superhero' }, | ||
{ | ||
$pull: { | ||
permissions: { | ||
$in: ['SCHOOL_EDIT_ALL'], | ||
}, | ||
}, | ||
} | ||
); | ||
|
||
if (adminRoleUpdate.modifiedCount > 0) { | ||
console.info('Rollback: Permission SCHOOL_EDIT_ALL added to role superhero.'); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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