mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
add in backend function unDeleteUser()
This commit is contained in:
parent
fed3562e4d
commit
fc3d7e2cbb
@ -1,7 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const unDeleteUser = gql`
|
||||
mutation ($userId: Int!) {
|
||||
mutation ($userId: Float!) {
|
||||
unDeleteUser(userId: $userId)
|
||||
}
|
||||
`
|
||||
|
||||
@ -27,4 +27,5 @@ export enum RIGHTS {
|
||||
CONFIRM_PENDING_CREATION = 'CONFIRM_PENDING_CREATION',
|
||||
SEND_ACTIVATION_EMAIL = 'SEND_ACTIVATION_EMAIL',
|
||||
DELETE_USER = 'DELETE_USER',
|
||||
UNDELETE_USER = 'UNDELETE_USER',
|
||||
}
|
||||
|
||||
@ -114,6 +114,19 @@ export class AdminResolver {
|
||||
return true
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.UNDELETE_USER])
|
||||
@Mutation(() => Boolean)
|
||||
async unDeleteUser(@Arg('userId') userId: number): Promise<boolean> {
|
||||
const user = await User.findOne({ id: userId }, { withDeleted: true })
|
||||
// user exists ?
|
||||
if (!user) {
|
||||
throw new Error(`Could not find user with userId: ${userId}`)
|
||||
}
|
||||
// recover user account
|
||||
await user.recover()
|
||||
return true
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.CREATE_PENDING_CREATION])
|
||||
@Mutation(() => [Number])
|
||||
async createPendingCreation(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user