Skip to content

Commit

Permalink
Merge branch 'main' into EW-653
Browse files Browse the repository at this point in the history
  • Loading branch information
WahlMartin authored Oct 20, 2023
2 parents 0a3ae95 + e70a7b7 commit 13b9239
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ export class ClassInfoResponse {
@ApiPropertyOptional()
schoolYear?: string;

@ApiPropertyOptional()
isUpgradable?: boolean;

constructor(props: ClassInfoResponse) {
this.id = props.id;
this.type = props.type;
this.name = props.name;
this.externalSourceName = props.externalSourceName;
this.teachers = props.teachers;
this.schoolYear = props.schoolYear;
this.isUpgradable = props.isUpgradable;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class GroupResponseMapper {
externalSourceName: classInfo.externalSourceName,
teachers: classInfo.teachers,
schoolYear: classInfo.schoolYear,
isUpgradable: classInfo.isUpgradable,
});

return mapped;
Expand Down
3 changes: 3 additions & 0 deletions apps/server/src/modules/group/uc/dto/class-info.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ export class ClassInfoDto {

schoolYear?: string;

isUpgradable?: boolean;

constructor(props: ClassInfoDto) {
this.id = props.id;
this.type = props.type;
this.name = props.name;
this.externalSourceName = props.externalSourceName;
this.teachers = props.teachers;
this.schoolYear = props.schoolYear;
this.isUpgradable = props.isUpgradable;
}
}
2 changes: 2 additions & 0 deletions apps/server/src/modules/group/uc/group.uc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ describe('GroupUc', () => {
externalSourceName: clazz.source,
teachers: [teacherUser.lastName],
schoolYear: schoolYear.name,
isUpgradable: false,
},
{
id: group.id,
Expand Down Expand Up @@ -290,6 +291,7 @@ describe('GroupUc', () => {
externalSourceName: clazz.source,
teachers: [teacherUser.lastName],
schoolYear: schoolYear.name,
isUpgradable: false,
},
{
id: groupWithSystem.id,
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/modules/group/uc/mapper/group-uc.mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -34,6 +35,7 @@ export class GroupUcMapper {
externalSourceName: clazz.source,
teachers: teachers.map((user: UserDO) => user.lastName),
schoolYear: schoolYear?.name,
isUpgradable,
});

return mapped;
Expand Down
37 changes: 37 additions & 0 deletions backup/setup/groups.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
]

0 comments on commit 13b9239

Please sign in to comment.