Skip to content

Commit

Permalink
BC-4375 - make methods static private
Browse files Browse the repository at this point in the history
  • Loading branch information
virgilchiriac committed Sep 20, 2023
1 parent e730901 commit ca7d974
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions apps/server/src/shared/domain/entity/course.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ export class Course
}

public getStudentIds(): EntityId[] {
const studentIds = this.extractIds(this.students);
const studentIds = Course.extractIds(this.students);
return studentIds;
}

public getTeacherIds(): EntityId[] {
const teacherIds = this.extractIds(this.teachers);
const teacherIds = Course.extractIds(this.teachers);
return teacherIds;
}

public getSubstitutionTeacherIds(): EntityId[] {
const substitutionTeacherIds = this.extractIds(this.substitutionTeachers);
const substitutionTeacherIds = Course.extractIds(this.substitutionTeachers);
return substitutionTeacherIds;
}

private extractIds(users: Collection<User>): EntityId[] {
private static extractIds(users: Collection<User>): EntityId[] {
if (!users) {
throw new InternalServerErrorException(
`Students, teachers or stubstitution is undefined. The course needs to be populated`
Expand All @@ -141,7 +141,7 @@ export class Course
public getStudentsList(): UsersList[] {
const users = this.students.getItems();
if (users.length) {
const usersList = this.extractUserList(users);
const usersList = Course.extractUserList(users);
return usersList;
}
return [];
Expand All @@ -150,7 +150,7 @@ export class Course
public getTeachersList(): UsersList[] {
const users = this.teachers.getItems();
if (users.length) {
const usersList = this.extractUserList(users);
const usersList = Course.extractUserList(users);
return usersList;
}
return [];
Expand All @@ -159,13 +159,13 @@ export class Course
public getSubstitutionTeachersList(): UsersList[] {
const users = this.substitutionTeachers.getItems();
if (users.length) {
const usersList = this.extractUserList(users);
const usersList = Course.extractUserList(users);
return usersList;
}
return [];
}

private extractUserList(users: User[]): UsersList[] {
private static extractUserList(users: User[]): UsersList[] {
const usersList: UsersList[] = users.map((user) => {
return {
id: user.id,
Expand Down

0 comments on commit ca7d974

Please sign in to comment.