2019-04-06 06:32:21 +08:00
|
|
|
import UserInfos from '/imports/api/users-infos';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2020-04-29 12:41:16 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-03-17 00:15:41 +08:00
|
|
|
import { check } from 'meteor/check';
|
2019-04-06 06:32:21 +08:00
|
|
|
|
2023-03-09 21:30:34 +08:00
|
|
|
export default async function removeUserInformation() {
|
2021-05-06 00:53:28 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2021-03-17 00:15:41 +08:00
|
|
|
|
2021-05-06 00:53:28 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
2021-03-17 00:15:41 +08:00
|
|
|
|
2021-05-06 00:53:28 +08:00
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
requesterUserId,
|
|
|
|
};
|
2020-11-25 04:44:13 +08:00
|
|
|
|
2023-03-09 21:30:34 +08:00
|
|
|
const numberAffected = await UserInfos.removeAsync(selector);
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Removed user information: requester id=${requesterUserId} meeting=${meetingId}`);
|
2019-04-06 06:32:21 +08:00
|
|
|
}
|
2020-11-25 04:44:13 +08:00
|
|
|
} catch (err) {
|
2021-05-06 00:53:28 +08:00
|
|
|
Logger.error(`Exception while invoking method removeUserInformation ${err.stack}`);
|
2020-11-25 04:44:13 +08:00
|
|
|
}
|
2019-04-06 06:32:21 +08:00
|
|
|
}
|