changes requested

This commit is contained in:
Moriz Wahl 2023-03-28 13:32:47 +02:00
parent ed8549bfb5
commit d7919ea10f
3 changed files with 5 additions and 6 deletions

View File

@ -304,7 +304,7 @@ export class TransactionResolver {
@Args() { identifier, amount, memo }: TransactionSendArgs,
@Ctx() context: Context,
): Promise<boolean> {
logger.info(`sendCoins(email=${email}, amount=${amount}, memo=${memo})`)
logger.info(`sendCoins(identifier=${identifier}, amount=${amount}, memo=${memo})`)
if (amount.lte(0)) {
throw new LogError('Amount to send must be positive', amount)
}

View File

@ -823,10 +823,9 @@ export class UserResolver {
}
@Authorized([RIGHTS.USER])
@Query(() => User, { nullable: true })
async user(@Arg('identifier') identifier: string): Promise<User | null> {
const user = await findUserByIdentifier(identifier)
return user ? new User(user) : null
@Query(() => User)
async user(@Arg('identifier') identifier: string): Promise<User> {
return new User(await findUserByIdentifier(identifier))
}
}

View File

@ -3,7 +3,7 @@ import { UserContact as DbUserContact } from '@entity/UserContact'
import LogError from '@/server/LogError'
import { validate, version } from 'uuid'
export const findUserByIdentifier = async (identifier: string): Promise<DbUser | null> => {
export const findUserByIdentifier = async (identifier: string): Promise<DbUser> => {
let user: DbUser | undefined
if (validate(identifier) && version(identifier) === 4) {
user = await DbUser.findOne({ where: { gradidoID: identifier }, relations: ['emailContact'] })