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,