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,