61 lines
1.0 KiB
JavaScript
61 lines
1.0 KiB
JavaScript
const db = require('../../data/db');
|
|
|
|
module.exports = {
|
|
addParticipant,
|
|
getParticipantById,
|
|
updateParticipant,
|
|
deleteParticipant,
|
|
// getMeetingsByParticipantId,
|
|
};
|
|
|
|
function addParticipant(data) {
|
|
return db('participant')
|
|
.insert(data)
|
|
.returning([
|
|
'id',
|
|
'email',
|
|
'account_id',
|
|
'meeting_id',
|
|
'quorum',
|
|
'mandatory',
|
|
'host',
|
|
'answered',
|
|
]);
|
|
}
|
|
|
|
function updateParticipant(data, id) {
|
|
return db('participant')
|
|
.where({ id })
|
|
.update(data)
|
|
.returning([
|
|
'id',
|
|
'email',
|
|
'account_id',
|
|
'meeting_id',
|
|
'quorum',
|
|
'mandatory',
|
|
'host',
|
|
'answered',
|
|
]);
|
|
}
|
|
|
|
function deleteParticipant(id) {
|
|
return db('participant').where({id }).del();
|
|
}
|
|
|
|
function getParticipantById(id) {
|
|
return db('participant')
|
|
.where({ id })
|
|
.first()
|
|
.select(
|
|
'id',
|
|
'email',
|
|
'account_id',
|
|
'meeting_id',
|
|
'quorum',
|
|
'mandatory',
|
|
'host',
|
|
'answered',
|
|
);
|
|
}
|