From c69c51060422e81d2b42ab7390a746a708bc9b72 Mon Sep 17 00:00:00 2001 From: rui hildt Date: Fri, 28 Aug 2020 19:02:50 +0200 Subject: [PATCH] Update remaining models to db change --- api/models/meetingModel.js | 8 +++-- api/models/participantModel.js | 54 +++++++++++++++++----------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/api/models/meetingModel.js b/api/models/meetingModel.js index 049f543..85cf371 100644 --- a/api/models/meetingModel.js +++ b/api/models/meetingModel.js @@ -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', diff --git a/api/models/participantModel.js b/api/models/participantModel.js index 2624846..ae5d7ce 100644 --- a/api/models/participantModel.js +++ b/api/models/participantModel.js @@ -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', +// ); +// }