Audio captions back-end migrated to new async API
This commit is contained in:
parent
5add111aa9
commit
03e037b5ea
@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor';
|
||||
const AudioCaptions = new Mongo.Collection('audio-captions');
|
||||
|
||||
if (Meteor.isServer) {
|
||||
AudioCaptions._ensureIndex({ meetingId: 1 });
|
||||
AudioCaptions.createIndexAsync({ meetingId: 1 });
|
||||
}
|
||||
|
||||
export default AudioCaptions;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import setTranscript from '/imports/api/audio-captions/server/modifiers/setTranscript';
|
||||
|
||||
export default function transcriptUpdated({ header, body }) {
|
||||
export default async function transcriptUpdated({ header, body }) {
|
||||
const { meetingId } = header;
|
||||
|
||||
const {
|
||||
@ -8,5 +8,5 @@ export default function transcriptUpdated({ header, body }) {
|
||||
transcript,
|
||||
} = body;
|
||||
|
||||
setTranscript(meetingId, transcriptId, transcript);
|
||||
await setTranscript(meetingId, transcriptId, transcript);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import AudioCaptions from '/imports/api/audio-captions';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function clearAudioCaptions(meetingId) {
|
||||
export default async function clearAudioCaptions(meetingId) {
|
||||
if (meetingId) {
|
||||
try {
|
||||
const numberAffected = AudioCaptions.remove({ meetingId });
|
||||
const numberAffected = await AudioCaptions.removeAsync({ meetingId });
|
||||
|
||||
if (numberAffected) {
|
||||
Logger.info(`Cleared AudioCaptions (${meetingId})`);
|
||||
@ -14,7 +14,7 @@ export default function clearAudioCaptions(meetingId) {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const numberAffected = AudioCaptions.remove({});
|
||||
const numberAffected = await AudioCaptions.removeAsync({});
|
||||
|
||||
if (numberAffected) {
|
||||
Logger.info('Cleared AudioCaptions (all)');
|
||||
|
@ -2,7 +2,7 @@ import { check } from 'meteor/check';
|
||||
import AudioCaptions from '/imports/api/audio-captions';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function setTranscript(meetingId, transcriptId, transcript) {
|
||||
export default async function setTranscript(meetingId, transcriptId, transcript) {
|
||||
try {
|
||||
check(meetingId, String);
|
||||
check(transcriptId, String);
|
||||
@ -17,7 +17,7 @@ export default function setTranscript(meetingId, transcriptId, transcript) {
|
||||
},
|
||||
};
|
||||
|
||||
const numberAffected = AudioCaptions.upsert(selector, modifier);
|
||||
const numberAffected = await AudioCaptions.upsertAsync(selector, modifier);
|
||||
|
||||
if (numberAffected) {
|
||||
Logger.debug(`Set transcriptId=${transcriptId} transcript=${transcript} meeting=${meetingId}`);
|
||||
|
@ -3,8 +3,9 @@ import { Meteor } from 'meteor/meteor';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
|
||||
|
||||
function audioCaptions() {
|
||||
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
|
||||
async function audioCaptions() {
|
||||
const tokenValidation = await AuthTokenValidation
|
||||
.findOneAsync({ connectionId: this.connection.id });
|
||||
|
||||
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
|
||||
Logger.warn(`Publishing AudioCaptions was requested by unauth connection ${this.connection.id}`);
|
||||
|
Loading…
Reference in New Issue
Block a user