diff --git a/app/gen-server/migration/1734097274107-GroupTypes.ts b/app/gen-server/migration/1734097274107-GroupTypes.ts index 42a9bbe750..e8d87e1d68 100644 --- a/app/gen-server/migration/1734097274107-GroupTypes.ts +++ b/app/gen-server/migration/1734097274107-GroupTypes.ts @@ -21,9 +21,10 @@ export class GroupTypes1734097274107 implements MigrationInterface { await queryRunner.manager .query('UPDATE groups SET type = $1', [Group.ROLE_TYPE]); - newColumn.isNullable = false; + const newColumnNonNull = newColumn.clone(); + newColumnNonNull.isNullable = false; - await queryRunner.changeColumn('groups', newColumn.name, newColumn); + await queryRunner.changeColumn('groups', newColumn, newColumnNonNull); } public async down(queryRunner: QueryRunner): Promise { diff --git a/test/gen-server/lib/homedb/UsersManager.ts b/test/gen-server/lib/homedb/UsersManager.ts index e8aedc6ccf..b8acb62ecc 100644 --- a/test/gen-server/lib/homedb/UsersManager.ts +++ b/test/gen-server/lib/homedb/UsersManager.ts @@ -71,12 +71,12 @@ describe('UsersManager', function () { const idxIterator = makeUserIdIterator(); for (const [idx, resource] of resources.entries()) { const aclRule = new AclRuleOrg(); - const group = new Group(); - if (makeResourceGrpName) { - group.name = makeResourceGrpName(idx); - } const members = makeUsers(nbUsersByResource, idxIterator); - group.memberUsers = members; + const group = Group.create({ + name: makeResourceGrpName?.(idx), + type: Group.ROLE_TYPE, + memberUsers: members + }); aclRule.group = group; resource.aclRules = [ aclRule diff --git a/test/gen-server/seed.ts b/test/gen-server/seed.ts index 11b6f4cfd1..c222316c22 100644 --- a/test/gen-server/seed.ts +++ b/test/gen-server/seed.ts @@ -310,14 +310,10 @@ class Seed { } public async createGroups(parent?: Organization|Workspace): Promise { - const owners = new Group(); - owners.name = 'owners'; - const editors = new Group(); - editors.name = 'editors'; - const viewers = new Group(); - viewers.name = 'viewers'; - const guests = new Group(); - guests.name = 'guests'; + const owners = Group.create({name: 'owners', type: Group.ROLE_TYPE}); + const editors = Group.create({name: 'editors', type: Group.ROLE_TYPE}); + const viewers = Group.create({name: 'viewers', type: Group.ROLE_TYPE}); + const guests = Group.create({name: 'guests', type: Group.ROLE_TYPE}); if (parent) { // Nest the parent groups inside the new groups @@ -331,8 +327,7 @@ class Seed { if (!parent) { // Add the members group for orgs. - const members = new Group(); - members.name = 'members'; + const members = Group.create({name: 'members', type: Group.ROLE_TYPE}); await this.groupRepository.save(members); return { owners,