Complete account endpoints

This commit is contained in:
2020-05-06 12:30:32 +02:00
parent a6dd5bb7f4
commit ad7ca3136a
2 changed files with 38 additions and 29 deletions

View File

@@ -5,7 +5,7 @@ module.exports = {
getAccountById,
updateAccount,
deleteAccount,
// getMeetingsByAccountId,
getMeetingsByAccountId,
};
function addAccount(data) {
@@ -39,20 +39,20 @@ function deleteAccount(id) {
return db('account').where({ id }).del();
}
// function getMeetingsByAccountId(id) {
// // Get all meetings to which an account is participating
// // select id, title, description, start_time, timezone, duration, status where
// return db('participant')
// .where({ id })
// .select(
// 'id',
// 'username',
// 'email',
// 'timezone',
// 'earliest_time',
// 'latest_time',
// );
// }
function getMeetingsByAccountId(account_id) {
return db('participant as p')
.select(
'm.id',
'm.title',
'm.description',
'm.start_time',
'm.timezone',
'm.duration',
'm.status',
)
.join('meeting as m', { 'm.id': 'p.meeting_id' })
.where({ account_id });
}
function getAccountById(id) {
return db('account')