From b28ac9c901e5404960e968e85f46141444d1849f Mon Sep 17 00:00:00 2001 From: jusax23 Date: Sat, 25 Mar 2023 16:06:17 +0100 Subject: [PATCH] changeViewable --- src/api/acts/client.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/api/acts/client.ts b/src/api/acts/client.ts index 66673bc..aa6df78 100644 --- a/src/api/acts/client.ts +++ b/src/api/acts/client.ts @@ -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,