getAccounts added delete time

This commit is contained in:
jusax23 2023-04-06 14:02:43 +02:00
parent 76d314ec00
commit b70527032e
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -17,6 +17,7 @@ export const getAccounts: Act = {
accounts.name, accounts.name,
accounts.viewable, accounts.viewable,
accounts.deleted, accounts.deleted,
accounts.deletedTime,
accounts.maxRooms, accounts.maxRooms,
accounts.maxRoomSize, accounts.maxRoomSize,
accounts.maxUsersPerRoom accounts.maxUsersPerRoom
@ -28,11 +29,12 @@ export const getAccounts: Act = {
let name = d[accounts.name]; let name = d[accounts.name];
let viewable = d[accounts.viewable] ? true : false; let viewable = d[accounts.viewable] ? true : false;
let deleted = d[accounts.deleted] ? true : false; let deleted = d[accounts.deleted] ? true : false;
let deletedTime = Number(d[accounts.deletedTime]);
let maxRooms = d[accounts.maxRooms]; let maxRooms = d[accounts.maxRooms];
let maxRoomSize = d[accounts.maxRoomSize]; let maxRoomSize = d[accounts.maxRoomSize];
let maxUsersPerRoom = d[accounts.maxUsersPerRoom]; let maxUsersPerRoom = d[accounts.maxUsersPerRoom];
if (accID != null && rights != null && name != null && viewable != null && deleted != null && maxRooms != null && maxRoomSize != null && maxUsersPerRoom != null) { if (accID != null && rights != null && name != null && viewable != null && deleted != null && maxRooms != null && maxRoomSize != null && maxUsersPerRoom != null && deletedTime != null) {
return { accID, rights, name, viewable, deleted, maxRooms, maxRoomSize, maxUsersPerRoom }; return { accID, rights, name, viewable, deleted, deletedTime, maxRooms, maxRoomSize, maxUsersPerRoom };
} }
return null; return null;
}); });
@ -150,7 +152,7 @@ export const addOTA: Act = { // or change it, primary key is the token
let resp = await insert(signupOTA.token, signupOTA.expires, signupOTA.usesLeft) let resp = await insert(signupOTA.token, signupOTA.expires, signupOTA.usesLeft)
.add(data.token, data.expires, data.usesLeft) .add(data.token, data.expires, data.usesLeft)
.query(db); .query(db);
if(resp.affectedRows == 0) throw new Error("insertion fail"); if (resp.affectedRows == 0) throw new Error("insertion fail");
} catch (error) { } catch (error) {
await update(signupOTA) await update(signupOTA)
.set(signupOTA.expires, data.expires) .set(signupOTA.expires, data.expires)