feat(captions): write in the pad

This commit is contained in:
Lucas Fialho Zawacki 2022-12-01 12:15:26 -03:00
parent dbf5143941
commit 876d8aa940

View File

@ -1,12 +1,23 @@
import setTranscript from '/imports/api/audio-captions/server/modifiers/setTranscript';
import updatePad from '/imports/api/pads/server/methods/updatePad';
import Users from '/imports/api/users';
export default function transcriptUpdated({ header, body }) {
const { meetingId } = header;
const {
meetingId,
userId,
} = header;
const {
transcriptId,
transcript,
locale,
} = body;
const user = Users.findOne({ userId }, { fields: { name: 1 } });
const datetime = new Date(Date.now());
const userSpoke = `\n ${user.name} (${datetime.getHours()}:${datetime.getMinutes()}): ${transcript}`;
updatePad(meetingId, userId, 'en', userSpoke);
setTranscript(meetingId, transcriptId, transcript);
}