Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-8362 - RoomMember groups are shown in class administration and during sync of courses with groups #5333

Merged
merged 4 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ describe(GroupAggregateScope.name, () => {
const result = new GroupAggregateScope().byAvailableForSync(true).build();

expect(result).toEqual([
{
$match: {
$or: [
{ type: { $eq: GroupTypes.CLASS } },
{ type: { $eq: GroupTypes.COURSE } },
{ type: { $eq: GroupTypes.OTHER } },
],
},
},
{
$lookup: {
from: 'courses',
Expand Down
9 changes: 9 additions & 0 deletions apps/server/src/modules/group/domain/group-aggregate.scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ export class GroupAggregateScope extends MongoDbScope<GroupEntity> {
byAvailableForSync(value: boolean | undefined): this {
if (value) {
this.pipeline.push(
{
$match: {
$or: [
{ type: { $eq: GroupTypes.CLASS } },
{ type: { $eq: GroupTypes.COURSE } },
{ type: { $eq: GroupTypes.OTHER } },
],
},
},
{
$lookup: {
from: 'courses',
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/group/uc/class-group.uc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ describe('ClassGroupUc', () => {

expect(groupService.findGroups).toHaveBeenCalledWith<[GroupFilter]>({
userId: teacherUser.id,
groupTypes: [GroupTypes.CLASS],
groupTypes: [GroupTypes.CLASS, GroupTypes.COURSE, GroupTypes.OTHER],
});
});
});
Expand Down Expand Up @@ -777,7 +777,7 @@ describe('ClassGroupUc', () => {

expect(groupService.findGroups).toHaveBeenCalledWith<[GroupFilter]>({
schoolId: teacherUser.school.id,
groupTypes: [GroupTypes.CLASS],
groupTypes: [GroupTypes.CLASS, GroupTypes.COURSE, GroupTypes.OTHER],
});
});
});
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/group/uc/class-group.uc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class ClassGroupUc {
}

private async findGroupsForSchool(schoolId: EntityId): Promise<ClassInfoDto[]> {
const filter: GroupFilter = { schoolId, groupTypes: [GroupTypes.CLASS] };
const filter: GroupFilter = { schoolId, groupTypes: [GroupTypes.CLASS, GroupTypes.COURSE, GroupTypes.OTHER] };

const groups: Page<Group> = await this.groupService.findGroups(filter);

Expand All @@ -227,7 +227,7 @@ export class ClassGroupUc {
}

private async findGroupsForUser(userId: EntityId): Promise<ClassInfoDto[]> {
const filter: GroupFilter = { userId, groupTypes: [GroupTypes.CLASS] };
const filter: GroupFilter = { userId, groupTypes: [GroupTypes.CLASS, GroupTypes.COURSE, GroupTypes.OTHER] };

const groups: Page<Group> = await this.groupService.findGroups(filter);

Expand Down
Loading