change from datamapper to active pattern (we mix it now)

This commit is contained in:
Einhornimmond 2021-09-30 18:40:15 +02:00 committed by einhornimmond
parent e6c3974748
commit 92179fc558
2 changed files with 549 additions and 588 deletions

View File

@ -3,7 +3,6 @@
import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql' import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql'
import { from_hex as fromHex } from 'libsodium-wrappers' import { from_hex as fromHex } from 'libsodium-wrappers'
import { getRepository } from 'typeorm'
import CONFIG from '../../config' import CONFIG from '../../config'
import { CheckUsernameResponse } from '../models/CheckUsernameResponse' import { CheckUsernameResponse } from '../models/CheckUsernameResponse'
import { LoginViaVerificationCode } from '../models/LoginViaVerificationCode' import { LoginViaVerificationCode } from '../models/LoginViaVerificationCode'
@ -95,8 +94,7 @@ export class UserResolver {
user.lastName = qluser.lastName user.lastName = qluser.lastName
user.username = qluser.username user.username = qluser.username
const repository = getRepository(DbUser) user.save().catch(() => {
repository.save(user).catch(() => {
throw new Error('error saving user') throw new Error('error saving user')
}) })

File diff suppressed because it is too large Load Diff