From 39475fdb4733ef07080fca3da64411acc8453bc2 Mon Sep 17 00:00:00 2001 From: jusax23 Date: Thu, 6 Apr 2023 14:10:05 +0200 Subject: [PATCH] recover Account --- src/api/acts/admin.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/api/acts/admin.ts b/src/api/acts/admin.ts index 1f4cd7c..0fb9698 100644 --- a/src/api/acts/admin.ts +++ b/src/api/acts/admin.ts @@ -42,6 +42,23 @@ export const getAccounts: Act = { } }; +export const recoverAccount: Act = { + state: STATE.client, + right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_USERS, + data: { + accID: "number" + }, + func: async (client: Client, data: any, aws: (code: string, data: any) => void) => { + let req = await update(accounts) + .set(accounts.deleted, false) + .set(accounts.deletedTime, 0) + .where(eq(accounts.accID, data.accID)) + .query(db); + if(req.affectedRows > 0) aws("ok", ""); + else aws("error", act_error.ACCOUNT_NOT_EXISTS) + } +} + export const setPermissions: Act = { state: STATE.client, right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_RIGHTS,