recover Account

This commit is contained in:
jusax23 2023-04-06 14:10:05 +02:00
parent b70527032e
commit 39475fdb47
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -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 = { export const setPermissions: Act = {
state: STATE.client, state: STATE.client,
right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_RIGHTS, right: PERMISSIONS.CAN_USE_API | PERMISSIONS.EDIT_RIGHTS,