2021-03-05 06:26:25 +08:00
|
|
|
import Users from '/imports/api/users';
|
|
|
|
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
|
|
|
|
|
2023-03-09 01:36:40 +08:00
|
|
|
const getMultiUser = async (meetingId, whiteboardId) => {
|
|
|
|
const data = await WhiteboardMultiUser.findOneAsync(
|
2021-03-05 06:26:25 +08:00
|
|
|
{
|
|
|
|
meetingId,
|
|
|
|
whiteboardId,
|
|
|
|
}, { fields: { multiUser: 1 } },
|
|
|
|
);
|
|
|
|
|
|
|
|
if (!data || !data.multiUser || !Array.isArray(data.multiUser)) return [];
|
|
|
|
|
|
|
|
return data.multiUser;
|
|
|
|
};
|
|
|
|
|
2023-03-09 01:36:40 +08:00
|
|
|
const getUsers = async (meetingId) => {
|
|
|
|
const data = await Users.find(
|
2021-03-05 06:26:25 +08:00
|
|
|
{ meetingId },
|
|
|
|
{ fields: { userId: 1 } },
|
2023-03-09 01:36:40 +08:00
|
|
|
).fetchAsync();
|
2021-03-05 06:26:25 +08:00
|
|
|
|
|
|
|
if (!data) return [];
|
|
|
|
|
|
|
|
return data.map(user => user.userId);
|
|
|
|
};
|
|
|
|
|
|
|
|
export {
|
|
|
|
getMultiUser,
|
|
|
|
getUsers,
|
|
|
|
};
|