mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
remove query for checkEmail as it is included in the user model now
This commit is contained in:
parent
89a8c25b44
commit
2c88bc0383
@ -22,7 +22,6 @@ import { BalanceRepository } from '../../typeorm/repository/Balance'
|
||||
import { calculateDecay } from '../../util/decay'
|
||||
import { AdminPendingCreation } from '@entity/AdminPendingCreation'
|
||||
import { hasElopageBuys } from '../../util/hasElopageBuys'
|
||||
import { User as dbUser } from '@entity/User'
|
||||
|
||||
@Resolver()
|
||||
export class AdminResolver {
|
||||
@ -41,7 +40,7 @@ export class AdminResolver {
|
||||
adminUser.lastName = user.lastName
|
||||
adminUser.email = user.email
|
||||
adminUser.creation = await getUserCreations(user.id)
|
||||
adminUser.emailChecked = await hasActivatedEmail(user.email)
|
||||
adminUser.emailChecked = user.emailChecked
|
||||
adminUser.hasElopage = await hasElopageBuys(user.email)
|
||||
return adminUser
|
||||
}),
|
||||
@ -61,8 +60,7 @@ export class AdminResolver {
|
||||
): Promise<number[]> {
|
||||
const userRepository = getCustomRepository(UserRepository)
|
||||
const user = await userRepository.findByEmail(email)
|
||||
const isActivated = await hasActivatedEmail(user.email)
|
||||
if (!isActivated) {
|
||||
if (user.emailChecked) {
|
||||
throw new Error('Creation could not be saved, Email is not activated')
|
||||
}
|
||||
const creations = await getUserCreations(user.id)
|
||||
@ -374,8 +372,3 @@ function isCreationValid(creations: number[], amount: number, creationDate: Date
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
async function hasActivatedEmail(email: string): Promise<boolean> {
|
||||
const user = await dbUser.findOne({ email })
|
||||
return user ? user.emailChecked : false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user