Update remaining models to db change

This commit is contained in:
rui hildt 2020-08-28 19:02:50 +02:00
parent f53842271a
commit c69c510604
2 changed files with 32 additions and 30 deletions

View File

@ -20,6 +20,7 @@ function addMeeting(data) {
'start_time',
'duration',
'status',
'password',
]);
}
@ -34,6 +35,7 @@ function updateMeeting(data, id) {
'start_time',
'duration',
'status',
'password',
]);
}
@ -52,6 +54,7 @@ function getMeetingById(id) {
'start_time',
'duration',
'status',
'password',
);
}
@ -59,8 +62,8 @@ function getParticipantsByMeetingId(meeting_id) {
return db('participant as p')
.select(
'p.id',
'p.account_id',
'p.email',
'p.account_id',
'p.meeting_id',
'p.quorum',
'p.mandatory',
@ -82,8 +85,7 @@ function getAvailabilityByMeetingId(meeting_id) {
return db('availability as a')
.select(
'a.id',
'a.meeting_id',
'a.account_id',
'a.participant_id',
'a.possible_date_id',
'a.preference',
'a.start_time',

View File

@ -2,10 +2,10 @@ const db = require('../../data/db');
module.exports = {
addParticipant,
getParticipantById,
updateParticipant,
deleteParticipant,
// getMeetingsByParticipantId,
// getParticipantById,
};
function addParticipant(data) {
@ -14,11 +14,11 @@ function addParticipant(data) {
.returning([
'id',
'email',
'account_id',
'meeting_id',
'quorum',
'mandatory',
'host',
'account_id',
'meeting_id',
'quorum',
'mandatory',
'host',
'answered',
]);
}
@ -30,31 +30,31 @@ function updateParticipant(data, id) {
.returning([
'id',
'email',
'account_id',
'meeting_id',
'quorum',
'mandatory',
'host',
'account_id',
'meeting_id',
'quorum',
'mandatory',
'host',
'answered',
]);
}
function deleteParticipant(id) {
return db('participant').where({id }).del();
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',
);
}
// function getParticipantById(id) {
// return db('participant')
// .where({ id })
// .first()
// .select(
// 'id',
// 'email',
// 'account_id',
// 'meeting_id',
// 'quorum',
// 'mandatory',
// 'host',
// 'answered',
// );
// }