Skip to content

Commit

Permalink
BC-8572 - room admin as default role (#3478)
Browse files Browse the repository at this point in the history
* adding a room member no longer requires passing a role, since the backend always assigns room-admin
  • Loading branch information
hoeppner-dataport authored Dec 16, 2024
1 parent 9287dda commit 65c7ab5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 51 deletions.
11 changes: 1 addition & 10 deletions src/modules/data/room/roomMembers/roomMembers.composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
SchoolApiFactory,
RoomMemberResponse,
SchoolForExternalInviteResponse,
UserIdAndRole,
UserIdAndRoleRoleNameEnum,
} from "@/serverApi/v3";
import { $axios } from "@/utils/api";
import { useI18n } from "vue-i18n";
Expand Down Expand Up @@ -112,15 +110,8 @@ export const useRoomMembers = (roomId: string) => {
userIds.includes(member.userId)
);

const userIdsAndRoles: UserIdAndRole[] = newMembers.map((member) => ({
userId: member.userId,
roleName: UserIdAndRoleRoleNameEnum.Roomeditor,
}));

try {
await roomApi.roomControllerAddMembers(roomId, {
userIdsAndRoles,
});
await roomApi.roomControllerAddMembers(roomId, { userIds });
roomMembers.value.push(
...newMembers.map((member) => ({
...member,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
RoleName,
RoomMemberResponse,
SchoolUserListResponse,
UserIdAndRoleRoleNameEnum,
} from "@/serverApi/v3/api";
import { useBoardNotifier } from "@util-board";
import { schoolsModule, authModule } from "@/store";
Expand Down Expand Up @@ -278,12 +277,7 @@ describe("useRoomMembers", () => {
expect(roomApiMock.roomControllerAddMembers).toHaveBeenCalledWith(
roomId,
{
userIdsAndRoles: [
{
userId: firstPotentialMember.userId,
roleName: UserIdAndRoleRoleNameEnum.Roomeditor,
},
],
userIds: [firstPotentialMember.userId],
}
);
expect(roomMembers.value).toEqual([
Expand Down
37 changes: 3 additions & 34 deletions src/serverApi/v3/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ export interface AccountSearchListResponse {
*/
export interface AddRoomMembersBodyParams {
/**
* Array of userIds and their roles inside of the room
* @type {Array<UserIdAndRole>}
* The IDs of the users
* @type {Array<string>}
* @memberof AddRoomMembersBodyParams
*/
userIdsAndRoles: Array<UserIdAndRole>;
userIds: Array<string>;
}
/**
*
Expand Down Expand Up @@ -9449,37 +9449,6 @@ export interface UserDataResponse {
*/
userId: string;
}
/**
*
* @export
* @interface UserIdAndRole
*/
export interface UserIdAndRole {
/**
* The ID of the user
* @type {string}
* @memberof UserIdAndRole
*/
userId: string;
/**
* The role of the user
* @type {string}
* @memberof UserIdAndRole
*/
roleName: UserIdAndRoleRoleNameEnum;
}

/**
* @export
* @enum {string}
*/
export enum UserIdAndRoleRoleNameEnum {
Roomowner = 'roomowner',
Roomadmin = 'roomadmin',
Roomeditor = 'roomeditor',
Roomviewer = 'roomviewer'
}

/**
*
* @export
Expand Down

0 comments on commit 65c7ab5

Please sign in to comment.