Skip to content

Commit

Permalink
add boolean to classInfo WIP (todo: unit/api test)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorCapCoder committed Oct 13, 2023
1 parent e3afbd4 commit 479d969
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class GroupResponseMapper {
name: classInfo.name,
externalSourceName: classInfo.externalSourceName,
teachers: classInfo.teachers,
isUpgradable: classInfo.isUpgradable,
});

return mapped;
Expand Down
2 changes: 2 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 @@ -5,6 +5,8 @@ export class ClassInfoDto {

teachers: string[];

isUpgradable?: boolean;

constructor(props: ClassInfoDto) {
this.name = props.name;
this.externalSourceName = props.externalSourceName;
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 @@ -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;
Expand Down

0 comments on commit 479d969

Please sign in to comment.