Update participant model and routes

This commit is contained in:
2020-08-28 14:08:13 +02:00
parent 9cdf4eedd2
commit d59a562fe2
4 changed files with 36 additions and 39 deletions

View File

@@ -1,13 +1,10 @@
const Participant = require('../api/models/participantModel');
async function validateParticipantID(req, res, next) {
const { account_id, meeting_id } = req.params;
const { id } = req.params;
try {
const participant = await Participant.getParticipantById(
account_id,
meeting_id,
);
const participant = await Participant.getParticipantById(id);
if (typeof participant == 'undefined') {
res.status(404).json({
message: `Participant with id ${id} doesn't exist.`,
@@ -17,10 +14,10 @@ async function validateParticipantID(req, res, next) {
}
} catch (error) {
res.status(500).json({
message: `Failed to get participant with id ${account_id}-${meeting_id}.`,
message: `Failed to get participant with id ${id}`,
error,
});
}
}
exports.validateParticipantID = validateParticipantID;
exports.validateParticipantID = validateParticipantID;