refactor(backend): Functions
This commit is contained in:
parent
5ec62554e3
commit
65c1a5e6b6
57 changed files with 172 additions and 117 deletions
|
@ -4,7 +4,7 @@ import { Assignment } from '../../entities/assignments/assignment.entity.js';
|
|||
import { Student } from '../../entities/users/student.entity.js';
|
||||
|
||||
export class GroupRepository extends DwengoEntityRepository<Group> {
|
||||
public findByAssignmentAndGroupNumber(assignment: Assignment, groupNumber: number): Promise<Group | null> {
|
||||
public async findByAssignmentAndGroupNumber(assignment: Assignment, groupNumber: number): Promise<Group | null> {
|
||||
return this.findOne(
|
||||
{
|
||||
assignment: assignment,
|
||||
|
@ -13,16 +13,16 @@ export class GroupRepository extends DwengoEntityRepository<Group> {
|
|||
{ populate: ['members'] }
|
||||
);
|
||||
}
|
||||
public findAllGroupsForAssignment(assignment: Assignment): Promise<Group[]> {
|
||||
public async findAllGroupsForAssignment(assignment: Assignment): Promise<Group[]> {
|
||||
return this.findAll({
|
||||
where: { assignment: assignment },
|
||||
populate: ['members'],
|
||||
});
|
||||
}
|
||||
public findAllGroupsWithStudent(student: Student): Promise<Group[]> {
|
||||
public async findAllGroupsWithStudent(student: Student): Promise<Group[]> {
|
||||
return this.find({ members: student }, { populate: ['members'] });
|
||||
}
|
||||
public deleteByAssignmentAndGroupNumber(assignment: Assignment, groupNumber: number) {
|
||||
public async deleteByAssignmentAndGroupNumber(assignment: Assignment, groupNumber: number): Promise<void> {
|
||||
return this.deleteWhere({
|
||||
assignment: assignment,
|
||||
groupNumber: groupNumber,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue