changeViewable

This commit is contained in:
jusax23 2023-03-25 16:06:17 +01:00
parent a6a59fa3fa
commit b28ac9c901
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -91,6 +91,26 @@ export const changePassword: Act = {
}
};
export const changeViewable: Act = {
state: STATE.client,
right: PERMISSIONS.CAN_USE_API,
data: {
viewable: "boolean"
},
func: async (client: Client, data: any, aws: (code: string, data: any) => void) => {
let req = await update(accounts)
.set(accounts.viewable, data.viewable)
.where(eq(accounts.accID, client.accID))
.query(db);
if (req.affectedRows > 0) {
aws("ok", "");
} else {
client.suspect();
aws("error", "existence");
}
}
}
export const createRoom: Act = {
state: STATE.client,
right: PERMISSIONS.CAN_USE_API,