From 479d969e609f30d3dd5005083b715daded9610ba Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Fri, 13 Oct 2023 17:56:08 +0200 Subject: [PATCH 1/5] add boolean to classInfo WIP (todo: unit/api test) --- .../group/controller/dto/response/class-info.response.ts | 4 ++++ .../modules/group/controller/mapper/group-response.mapper.ts | 1 + apps/server/src/modules/group/uc/dto/class-info.dto.ts | 2 ++ apps/server/src/modules/group/uc/mapper/group-uc.mapper.ts | 2 ++ 4 files changed, 9 insertions(+) diff --git a/apps/server/src/modules/group/controller/dto/response/class-info.response.ts b/apps/server/src/modules/group/controller/dto/response/class-info.response.ts index a2d71333c04..443601b07f8 100644 --- a/apps/server/src/modules/group/controller/dto/response/class-info.response.ts +++ b/apps/server/src/modules/group/controller/dto/response/class-info.response.ts @@ -10,9 +10,13 @@ export class ClassInfoResponse { @ApiProperty({ type: [String] }) teachers: string[]; + @ApiPropertyOptional() + isUpgradable?: boolean; + constructor(props: ClassInfoResponse) { this.name = props.name; this.externalSourceName = props.externalSourceName; this.teachers = props.teachers; + this.isUpgradable = props.isUpgradable; } } diff --git a/apps/server/src/modules/group/controller/mapper/group-response.mapper.ts b/apps/server/src/modules/group/controller/mapper/group-response.mapper.ts index 6fbb0c6dc65..452ba24a510 100644 --- a/apps/server/src/modules/group/controller/mapper/group-response.mapper.ts +++ b/apps/server/src/modules/group/controller/mapper/group-response.mapper.ts @@ -27,6 +27,7 @@ export class GroupResponseMapper { name: classInfo.name, externalSourceName: classInfo.externalSourceName, teachers: classInfo.teachers, + isUpgradable: classInfo.isUpgradable, }); return mapped; diff --git a/apps/server/src/modules/group/uc/dto/class-info.dto.ts b/apps/server/src/modules/group/uc/dto/class-info.dto.ts index 0d2b5adaf68..6d555789dc0 100644 --- a/apps/server/src/modules/group/uc/dto/class-info.dto.ts +++ b/apps/server/src/modules/group/uc/dto/class-info.dto.ts @@ -5,6 +5,8 @@ export class ClassInfoDto { teachers: string[]; + isUpgradable?: boolean; + constructor(props: ClassInfoDto) { this.name = props.name; this.externalSourceName = props.externalSourceName; diff --git a/apps/server/src/modules/group/uc/mapper/group-uc.mapper.ts b/apps/server/src/modules/group/uc/mapper/group-uc.mapper.ts index 1e1f11057ce..fce6fbc6ddb 100644 --- a/apps/server/src/modules/group/uc/mapper/group-uc.mapper.ts +++ b/apps/server/src/modules/group/uc/mapper/group-uc.mapper.ts @@ -23,11 +23,13 @@ export class GroupUcMapper { public static mapClassToClassInfoDto(clazz: Class, teachers: UserDO[]): ClassInfoDto { const name = clazz.gradeLevel ? `${clazz.gradeLevel}${clazz.name}` : clazz.name; + const isUpgradable = clazz.gradeLevel !== 13 && !clazz.successor; const mapped: ClassInfoDto = new ClassInfoDto({ name, externalSourceName: clazz.source, teachers: teachers.map((user: UserDO) => user.lastName), + isUpgradable, }); return mapped; From 44e671c4127c32024cfc46e461e82794c8029ef7 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Mon, 16 Oct 2023 11:26:03 +0200 Subject: [PATCH 2/5] tests --- .../src/modules/group/controller/api-test/group.api.spec.ts | 1 + apps/server/src/modules/group/uc/dto/class-info.dto.ts | 1 + apps/server/src/modules/group/uc/group.uc.spec.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/apps/server/src/modules/group/controller/api-test/group.api.spec.ts b/apps/server/src/modules/group/controller/api-test/group.api.spec.ts index f0561518c0c..1d87e5d5379 100644 --- a/apps/server/src/modules/group/controller/api-test/group.api.spec.ts +++ b/apps/server/src/modules/group/controller/api-test/group.api.spec.ts @@ -106,6 +106,7 @@ describe('Group (API)', () => { { name: clazz.gradeLevel ? `${clazz.gradeLevel}${clazz.name}` : clazz.name, teachers: [teacherUser.lastName], + isUpgradable: false, }, ], skip: 0, diff --git a/apps/server/src/modules/group/uc/dto/class-info.dto.ts b/apps/server/src/modules/group/uc/dto/class-info.dto.ts index 6d555789dc0..18268631f74 100644 --- a/apps/server/src/modules/group/uc/dto/class-info.dto.ts +++ b/apps/server/src/modules/group/uc/dto/class-info.dto.ts @@ -11,5 +11,6 @@ export class ClassInfoDto { this.name = props.name; this.externalSourceName = props.externalSourceName; this.teachers = props.teachers; + this.isUpgradable = props.isUpgradable; } } diff --git a/apps/server/src/modules/group/uc/group.uc.spec.ts b/apps/server/src/modules/group/uc/group.uc.spec.ts index b4115d3739b..d487b3f0126 100644 --- a/apps/server/src/modules/group/uc/group.uc.spec.ts +++ b/apps/server/src/modules/group/uc/group.uc.spec.ts @@ -229,6 +229,7 @@ describe('GroupUc', () => { name: clazz.gradeLevel ? `${clazz.gradeLevel}${clazz.name}` : clazz.name, externalSourceName: clazz.source, teachers: [teacherUser.lastName], + isUpgradable: false, }, { name: group.name, @@ -264,6 +265,7 @@ describe('GroupUc', () => { name: clazz.gradeLevel ? `${clazz.gradeLevel}${clazz.name}` : clazz.name, externalSourceName: clazz.source, teachers: [teacherUser.lastName], + isUpgradable: false, }, { name: groupWithSystem.name, From a71b3616f5741ec708bef1b6ddbc8553f95eae19 Mon Sep 17 00:00:00 2001 From: Igor Richter Date: Tue, 17 Oct 2023 15:10:48 +0200 Subject: [PATCH 3/5] add group to seed data --- backup/setup/groups.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 backup/setup/groups.json diff --git a/backup/setup/groups.json b/backup/setup/groups.json new file mode 100644 index 00000000000..c8c3f50a8bd --- /dev/null +++ b/backup/setup/groups.json @@ -0,0 +1,35 @@ +{ + "createdAt": { + "$date": "2023-10-17T12:15:26.458Z" + }, + "updatedAt": { + "$date": "2023-10-17T12:15:26.461Z" + }, + "name": "Cypress-Test-Group", + "type": "class", + "externalSource_externalId": "fd84869b-56e8-41d2-a3dd-6c7239068ed5", + "externalSource_system": { + "$oid": "0000d186816abba584714c93" + }, + "users": [ + { + "user": { + "$oid": "5fa2c71bb229544f2c6966d9" + }, + "role": { + "$oid": "0000d186816abba584714c98" + } + }, + { + "user": { + "$oid": "5fa2cccab229544f2c696917" + }, + "role": { + "$oid": "0000d186816abba584714c99" + } + } + ], + "organization": { + "$oid": "5fa2c5ccb229544f2c69666c" + } +} From 5306fa1481aecd7b4a823e5c56333e8b73e4ae14 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 20 Oct 2023 14:29:04 +0200 Subject: [PATCH 4/5] N21-1264 fix seed data --- backup/setup/groups.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup/setup/groups.json b/backup/setup/groups.json index c8c3f50a8bd..c0639e3cc32 100644 --- a/backup/setup/groups.json +++ b/backup/setup/groups.json @@ -1,4 +1,4 @@ -{ +[{ "createdAt": { "$date": "2023-10-17T12:15:26.458Z" }, @@ -32,4 +32,4 @@ "organization": { "$oid": "5fa2c5ccb229544f2c69666c" } -} +] From 9df10771d91362274421e02f80ca1ac4ab14ae34 Mon Sep 17 00:00:00 2001 From: Arne Gnisa Date: Fri, 20 Oct 2023 14:30:49 +0200 Subject: [PATCH 5/5] N21-1264 fixes seed data --- backup/setup/groups.json | 70 +++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/backup/setup/groups.json b/backup/setup/groups.json index c0639e3cc32..a682580f824 100644 --- a/backup/setup/groups.json +++ b/backup/setup/groups.json @@ -1,35 +1,37 @@ -[{ - "createdAt": { - "$date": "2023-10-17T12:15:26.458Z" - }, - "updatedAt": { - "$date": "2023-10-17T12:15:26.461Z" - }, - "name": "Cypress-Test-Group", - "type": "class", - "externalSource_externalId": "fd84869b-56e8-41d2-a3dd-6c7239068ed5", - "externalSource_system": { - "$oid": "0000d186816abba584714c93" - }, - "users": [ - { - "user": { - "$oid": "5fa2c71bb229544f2c6966d9" - }, - "role": { - "$oid": "0000d186816abba584714c98" - } - }, - { - "user": { - "$oid": "5fa2cccab229544f2c696917" - }, - "role": { - "$oid": "0000d186816abba584714c99" - } - } - ], - "organization": { - "$oid": "5fa2c5ccb229544f2c69666c" - } +[ + { + "createdAt": { + "$date": "2023-10-17T12:15:26.458Z" + }, + "updatedAt": { + "$date": "2023-10-17T12:15:26.461Z" + }, + "name": "Cypress-Test-Group", + "type": "class", + "externalSource_externalId": "fd84869b-56e8-41d2-a3dd-6c7239068ed5", + "externalSource_system": { + "$oid": "0000d186816abba584714c93" + }, + "users": [ + { + "user": { + "$oid": "5fa2c71bb229544f2c6966d9" + }, + "role": { + "$oid": "0000d186816abba584714c98" + } + }, + { + "user": { + "$oid": "5fa2cccab229544f2c696917" + }, + "role": { + "$oid": "0000d186816abba584714c99" + } + } + ], + "organization": { + "$oid": "5fa2c5ccb229544f2c69666c" + } + } ]