feat: teacher-class en teacher-students route
This commit is contained in:
parent
6b87722469
commit
9c9e7c4870
6 changed files with 146 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
|||
import { DwengoEntityRepository } from '../dwengo-entity-repository.js';
|
||||
import { Class } from '../../entities/classes/class.entity.js';
|
||||
import { Student } from '../../entities/users/student.entity.js';
|
||||
import {Teacher} from "../../entities/users/teacher.entity";
|
||||
|
||||
export class ClassRepository extends DwengoEntityRepository<Class> {
|
||||
public findById(id: string): Promise<Class | null> {
|
||||
|
@ -18,4 +19,11 @@ export class ClassRepository extends DwengoEntityRepository<Class> {
|
|||
{ populate: ["students", "teachers"] } // voegt student en teacher objecten toe
|
||||
)
|
||||
}
|
||||
|
||||
public findByTeacher(teacher: Teacher): Promise<Class[]> {
|
||||
return this.find(
|
||||
{ teachers: teacher },
|
||||
{ populate: ["students", "teachers"] }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue