2020-05-04 16:47:05 +00:00
|
|
|
const db = require('../../data/db');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
addParticipant,
|
|
|
|
getParticipantById,
|
|
|
|
updateParticipant,
|
|
|
|
deleteParticipant,
|
|
|
|
// getMeetingsByParticipantId,
|
|
|
|
};
|
|
|
|
|
|
|
|
function addParticipant(data) {
|
|
|
|
return db('participant')
|
|
|
|
.insert(data)
|
|
|
|
.returning([
|
2020-08-28 12:08:13 +00:00
|
|
|
'id',
|
|
|
|
'email',
|
2020-05-04 16:47:05 +00:00
|
|
|
'account_id',
|
|
|
|
'meeting_id',
|
|
|
|
'quorum',
|
|
|
|
'mandatory',
|
|
|
|
'host',
|
|
|
|
'answered',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:08:13 +00:00
|
|
|
function updateParticipant(data, id) {
|
2020-05-04 16:47:05 +00:00
|
|
|
return db('participant')
|
2020-08-28 12:08:13 +00:00
|
|
|
.where({ id })
|
2020-05-04 16:47:05 +00:00
|
|
|
.update(data)
|
|
|
|
.returning([
|
2020-08-28 12:08:13 +00:00
|
|
|
'id',
|
|
|
|
'email',
|
2020-05-04 16:47:05 +00:00
|
|
|
'account_id',
|
|
|
|
'meeting_id',
|
|
|
|
'quorum',
|
|
|
|
'mandatory',
|
|
|
|
'host',
|
|
|
|
'answered',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
2020-08-28 12:08:13 +00:00
|
|
|
function deleteParticipant(id) {
|
|
|
|
return db('participant').where({id }).del();
|
2020-05-04 16:47:05 +00:00
|
|
|
}
|
|
|
|
|
2020-08-28 12:08:13 +00:00
|
|
|
function getParticipantById(id) {
|
2020-05-04 16:47:05 +00:00
|
|
|
return db('participant')
|
2020-08-28 12:08:13 +00:00
|
|
|
.where({ id })
|
2020-05-04 16:47:05 +00:00
|
|
|
.first()
|
|
|
|
.select(
|
2020-08-28 12:08:13 +00:00
|
|
|
'id',
|
|
|
|
'email',
|
2020-05-04 16:47:05 +00:00
|
|
|
'account_id',
|
|
|
|
'meeting_id',
|
|
|
|
'quorum',
|
|
|
|
'mandatory',
|
|
|
|
'host',
|
|
|
|
'answered',
|
|
|
|
);
|
|
|
|
}
|