diff --git a/apps/server/src/modules/group/uc/class-group.uc.spec.ts b/apps/server/src/modules/group/uc/class-group.uc.spec.ts index 1fc5f3af59e..1dd1f18dc5d 100644 --- a/apps/server/src/modules/group/uc/class-group.uc.spec.ts +++ b/apps/server/src/modules/group/uc/class-group.uc.spec.ts @@ -33,7 +33,7 @@ import { userFactory, } from '@shared/testing'; import { ClassRequestContext, SchoolYearQueryType } from '../controller/dto/interface'; -import { Group, GroupFilter } from '../domain'; +import { Group, GroupFilter, GroupTypes } from '../domain'; import { UnknownQueryTypeLoggableException } from '../loggable'; import { GroupService } from '../service'; import { ClassInfoDto } from './dto'; @@ -407,12 +407,15 @@ describe('ClassGroupUc', () => { }); }); - it('should call group service with userId and no pagination', async () => { + it('should call group service with userId, group type class and no pagination', async () => { const { teacherUser } = setup(); await uc.findAllClasses(teacherUser.id, teacherUser.school.id); - expect(groupService.findGroups).toHaveBeenCalledWith<[GroupFilter]>({ userId: teacherUser.id }); + expect(groupService.findGroups).toHaveBeenCalledWith<[GroupFilter]>({ + userId: teacherUser.id, + groupTypes: [GroupTypes.CLASS], + }); }); }); @@ -767,12 +770,15 @@ describe('ClassGroupUc', () => { }); }); - it('should call group service with schoolId and no pagination', async () => { + it('should call group service with schoolId, group type class and no pagination', async () => { const { teacherUser } = setup(); await uc.findAllClasses(teacherUser.id, teacherUser.school.id); - expect(groupService.findGroups).toHaveBeenCalledWith<[GroupFilter]>({ schoolId: teacherUser.school.id }); + expect(groupService.findGroups).toHaveBeenCalledWith<[GroupFilter]>({ + schoolId: teacherUser.school.id, + groupTypes: [GroupTypes.CLASS], + }); }); }); diff --git a/apps/server/src/modules/group/uc/class-group.uc.ts b/apps/server/src/modules/group/uc/class-group.uc.ts index c37006ef414..bede2d7441b 100644 --- a/apps/server/src/modules/group/uc/class-group.uc.ts +++ b/apps/server/src/modules/group/uc/class-group.uc.ts @@ -15,7 +15,7 @@ import { Pagination, Permission, SortOrder } from '@shared/domain/interface'; import { EntityId } from '@shared/domain/types'; import { System, SystemService } from '@src/modules/system'; import { ClassRequestContext, SchoolYearQueryType } from '../controller/dto/interface'; -import { Group, GroupFilter } from '../domain'; +import { Group, GroupFilter, GroupTypes } from '../domain'; import { UnknownQueryTypeLoggableException } from '../loggable'; import { GroupService } from '../service'; import { ClassInfoDto, ResolvedGroupUser } from './dto'; @@ -217,7 +217,7 @@ export class ClassGroupUc { } private async findGroupsForSchool(schoolId: EntityId): Promise { - const filter: GroupFilter = { schoolId }; + const filter: GroupFilter = { schoolId, groupTypes: [GroupTypes.CLASS] }; const groups: Page = await this.groupService.findGroups(filter); @@ -227,7 +227,7 @@ export class ClassGroupUc { } private async findGroupsForUser(userId: EntityId): Promise { - const filter: GroupFilter = { userId }; + const filter: GroupFilter = { userId, groupTypes: [GroupTypes.CLASS] }; const groups: Page = await this.groupService.findGroups(filter);