mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
use Context interface in Transaction resolver
This commit is contained in:
parent
00bba07b11
commit
d7bec83d25
@ -1,8 +1,7 @@
|
||||
/* eslint-disable new-cap */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { Context, getUser } from '@/server/context'
|
||||
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
||||
import { getCustomRepository, getConnection } from '@dbTools/typeorm'
|
||||
|
||||
@ -147,10 +146,10 @@ export class TransactionResolver {
|
||||
async transactionList(
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 25, order = Order.DESC }: Paginated,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<TransactionList> {
|
||||
const now = new Date()
|
||||
const user = context.user
|
||||
const user = getUser(context)
|
||||
|
||||
// find current balance
|
||||
const lastTransaction = await dbTransaction.findOne(
|
||||
@ -247,10 +246,10 @@ export class TransactionResolver {
|
||||
@Mutation(() => String)
|
||||
async sendCoins(
|
||||
@Args() { email, amount, memo }: TransactionSendArgs,
|
||||
@Ctx() context: any,
|
||||
@Ctx() context: Context,
|
||||
): Promise<boolean> {
|
||||
// TODO this is subject to replay attacks
|
||||
const senderUser = context.user
|
||||
const senderUser = getUser(context)
|
||||
if (senderUser.pubKey.length !== 32) {
|
||||
throw new Error('invalid sender public key')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user