manal invite & remove member from shoppinglist

This commit is contained in:
Lukas Nowy
2019-02-20 23:12:28 +01:00
parent 8089359741
commit 9a3376702f
3 changed files with 36 additions and 18 deletions

View File

@ -382,6 +382,7 @@ async function createInvite(sl_id) {
}
}
//User manuell einladen
async function manInvite(sl_id, uid) {
try {
await nonQuery('INSERT INTO "Shoppinglist_member" (username, sl_id) VALUES ($1, $2);', [uid, sl_id]);
@ -392,7 +393,17 @@ async function manInvite(sl_id, uid) {
}
}
//member von shoppinglist entfernen
async function removeMember(uid, sl_id) {
try {
await nonQuery('DELETE FROM "Shoppinglist_member" WHERE username = $1 AND sl_id = $2', [uid, sl_id]);
}
catch(error) {
console.error(error);
}
}
@ -550,5 +561,5 @@ function probability(cur_item, data) {
module.exports = {
getShoppinglistsAdmin, getShoppinglistsShared, newShoppinglist, displayShoppinglist, deleteShoppinglist, addGroup,
addItem, verifyInvite, createInvite, editShoppinglist, editGroup, editItem, deleteGroup, deleteItem, manInvite, updateUser,
moveDoneItems, getDonePurchases, getShoppinglistsByLink, searchUsers
moveDoneItems, getDonePurchases, getShoppinglistsByLink, searchUsers, removeMember
}