mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
save user on create user in community server db
This commit is contained in:
parent
47119fe01a
commit
1177c69217
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ messages.pot
|
||||
nbproject
|
||||
.metadata
|
||||
/.env
|
||||
package-lock.json
|
||||
|
||||
4712
backend/package-lock.json
generated
4712
backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@
|
||||
"express": "^4.17.1",
|
||||
"graphql": "^15.5.1",
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"libsodium-wrappers": "^0.7.9",
|
||||
"mysql2": "^2.3.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"type-graphql": "^1.1.1",
|
||||
@ -31,6 +32,7 @@
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.12",
|
||||
"@types/jsonwebtoken": "^8.5.2",
|
||||
"@types/libsodium-wrappers": "^0.7.9",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.0",
|
||||
"@typescript-eslint/parser": "^4.28.0",
|
||||
"eslint": "^7.29.0",
|
||||
|
||||
@ -2,12 +2,15 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql'
|
||||
import { from_hex } from 'libsodium-wrappers'
|
||||
import { getRepository } from 'typeorm'
|
||||
import CONFIG from '../../config'
|
||||
import { CheckUsernameResponse } from '../models/CheckUsernameResponse'
|
||||
import { LoginViaVerificationCode } from '../models/LoginViaVerificationCode'
|
||||
import { SendPasswordResetEmailResponse } from '../models/SendPasswordResetEmailResponse'
|
||||
import { UpdateUserInfosResponse } from '../models/UpdateUserInfosResponse'
|
||||
import { User } from '../models/User'
|
||||
import { User as dbUser} from '../../typeorm/entity/User'
|
||||
import encode from '../../jwt/encode'
|
||||
import {
|
||||
ChangePasswordArgs,
|
||||
@ -84,7 +87,19 @@ export class UserResolver {
|
||||
if (!result.success) {
|
||||
throw new Error(result.data)
|
||||
}
|
||||
const qluser = new User(result.data.user)
|
||||
let user = new dbUser
|
||||
user.pubkey = Buffer.from(from_hex(qluser.pubkey))
|
||||
user.email = qluser.email
|
||||
user.firstName = qluser.firstName
|
||||
user.lastName = qluser.lastName
|
||||
user.username = qluser.username
|
||||
|
||||
const repository = getRepository(dbUser);
|
||||
repository.save(user).catch(() => {
|
||||
throw new Error('error saving user')
|
||||
});
|
||||
|
||||
return 'success'
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user