backend/api/models/participantModel.js

43 lines
640 B
JavaScript
Raw Normal View History

2020-05-04 16:47:05 +00:00
const db = require('../../data/db');
module.exports = {
addParticipant,
updateParticipant,
deleteParticipant,
};
function addParticipant(data) {
return db('participant')
.insert(data)
.returning([
2020-08-28 12:08:13 +00:00
'id',
'email',
2020-08-28 17:02:50 +00:00
'account_id',
'meeting_id',
'quorum',
'mandatory',
'host',
2020-05-04 16:47:05 +00:00
'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-08-28 17:02:50 +00:00
'account_id',
'meeting_id',
'quorum',
'mandatory',
'host',
2020-05-04 16:47:05 +00:00
'answered',
]);
}
2020-08-28 12:08:13 +00:00
function deleteParticipant(id) {
2020-08-28 17:02:50 +00:00
return db('participant').where({ id }).del();
2020-05-04 16:47:05 +00:00
}