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 471d8b348af..3ace7386565 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 @@ -126,6 +126,7 @@ describe('Group (API)', () => { name: clazz.gradeLevel ? `${clazz.gradeLevel}${clazz.name}` : clazz.name, teachers: [teacherUser.lastName], schoolYear: schoolYear.name, + isUpgradable: false, }, ], skip: 0, 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 62c52501b95..a62b8134158 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 @@ -20,6 +20,9 @@ export class ClassInfoResponse { @ApiPropertyOptional() schoolYear?: string; + @ApiPropertyOptional() + isUpgradable?: boolean; + constructor(props: ClassInfoResponse) { this.id = props.id; this.type = props.type; @@ -27,5 +30,6 @@ export class ClassInfoResponse { this.externalSourceName = props.externalSourceName; this.teachers = props.teachers; this.schoolYear = props.schoolYear; + 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 958aeee2c6b..5f337eb204c 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 @@ -30,6 +30,7 @@ export class GroupResponseMapper { externalSourceName: classInfo.externalSourceName, teachers: classInfo.teachers, schoolYear: classInfo.schoolYear, + 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 d17c0169c93..8c564d9e106 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 @@ -13,6 +13,8 @@ export class ClassInfoDto { schoolYear?: string; + isUpgradable?: boolean; + constructor(props: ClassInfoDto) { this.id = props.id; this.type = props.type; @@ -20,5 +22,6 @@ export class ClassInfoDto { this.externalSourceName = props.externalSourceName; this.teachers = props.teachers; this.schoolYear = props.schoolYear; + 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 3de4d262679..8e882c052d3 100644 --- a/apps/server/src/modules/group/uc/group.uc.spec.ts +++ b/apps/server/src/modules/group/uc/group.uc.spec.ts @@ -248,6 +248,7 @@ describe('GroupUc', () => { externalSourceName: clazz.source, teachers: [teacherUser.lastName], schoolYear: schoolYear.name, + isUpgradable: false, }, { id: group.id, @@ -290,6 +291,7 @@ describe('GroupUc', () => { externalSourceName: clazz.source, teachers: [teacherUser.lastName], schoolYear: schoolYear.name, + isUpgradable: false, }, { id: groupWithSystem.id, 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 d5a415498db..ebeba60117e 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 @@ -26,6 +26,7 @@ export class GroupUcMapper { public static mapClassToClassInfoDto(clazz: Class, teachers: UserDO[], schoolYear?: SchoolYearEntity): ClassInfoDto { const name = clazz.gradeLevel ? `${clazz.gradeLevel}${clazz.name}` : clazz.name; + const isUpgradable = clazz.gradeLevel !== 13 && !clazz.successor; const mapped: ClassInfoDto = new ClassInfoDto({ id: clazz.id, @@ -34,6 +35,7 @@ export class GroupUcMapper { externalSourceName: clazz.source, teachers: teachers.map((user: UserDO) => user.lastName), schoolYear: schoolYear?.name, + isUpgradable, }); return mapped; diff --git a/backup/setup/groups.json b/backup/setup/groups.json new file mode 100644 index 00000000000..a682580f824 --- /dev/null +++ b/backup/setup/groups.json @@ -0,0 +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" + } + } +]