feat: controller en service laag toegevoegd voor student/:id/classes
This commit is contained in:
parent
f5b6a5a604
commit
ceef74f1af
6 changed files with 127 additions and 23 deletions
|
@ -1,5 +1,6 @@
|
|||
import { DwengoEntityRepository } from '../dwengo-entity-repository.js';
|
||||
import { Class } from '../../entities/classes/class.entity.js';
|
||||
import { Student } from '../../entities/users/student.entity.js';
|
||||
|
||||
export class ClassRepository extends DwengoEntityRepository<Class> {
|
||||
public findById(id: string): Promise<Class | null> {
|
||||
|
@ -8,4 +9,10 @@ export class ClassRepository extends DwengoEntityRepository<Class> {
|
|||
public deleteById(id: string): Promise<void> {
|
||||
return this.deleteWhere({ classId: id });
|
||||
}
|
||||
public findByStudent(student: Student): Promise<Class[]> {
|
||||
return this.find(
|
||||
{ students: student },
|
||||
{ populate: ["students", "teachers"] } // voegt student en teacher objecten toe
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue