mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
correct graphql result definition for voteForSendCoins
This commit is contained in:
parent
32496a0353
commit
fe85e45d38
@ -34,18 +34,21 @@ export class SendCoinsClient {
|
||||
voteForSendCoins = async (args: SendCoinsArgs): Promise<SendCoinsResult> => {
|
||||
logger.debug('X-Com: voteForSendCoins against endpoint=', this.endpoint)
|
||||
try {
|
||||
logger.debug(`SendCoinsClient: voteForSendCoins with args=`, args)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const { data } = await this.client.rawRequest(voteForSendCoins, { args })
|
||||
logger.debug(`SendCoinsClient: after rawRequest...`, data)
|
||||
const sendCoinsResult = data as SendCoinsResult
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
if (!data?.voteForSendCoins?.vote) {
|
||||
if (!sendCoinsResult.vote) {
|
||||
logger.warn(
|
||||
'X-Com: voteForSendCoins failed with: ',
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
data.voteForSendCoins.recipGradidoID,
|
||||
sendCoinsResult.recipGradidoID,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
data.voteForSendCoins.recipName,
|
||||
sendCoinsResult.recipName,
|
||||
)
|
||||
return new SendCoinsResult()
|
||||
return sendCoinsResult
|
||||
}
|
||||
const result = new SendCoinsResult()
|
||||
result.vote = true
|
||||
|
||||
@ -121,7 +121,7 @@ export async function processXComPendingSendCoins(
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(`Error:`, err)
|
||||
throw new LogError(`Error:`, err)
|
||||
}
|
||||
return sendCoinsResult
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { ArgsType, Field } from 'type-graphql'
|
||||
import { Field, ObjectType } from 'type-graphql'
|
||||
|
||||
@ArgsType()
|
||||
@ObjectType()
|
||||
export class SendCoinsResult {
|
||||
constructor() {
|
||||
this.vote = false
|
||||
@ -9,9 +9,9 @@ export class SendCoinsResult {
|
||||
@Field(() => Boolean)
|
||||
vote: boolean
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@Field(() => String)
|
||||
recipGradidoID: string | null
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@Field(() => String)
|
||||
recipName: string | null
|
||||
}
|
||||
|
||||
@ -68,8 +68,13 @@ describe('SendCoinsResolver', () => {
|
||||
senderCommunityUuid: $senderCommunityUuid
|
||||
senderUserUuid: $senderUserUuid
|
||||
senderUserName: $senderUserName
|
||||
)
|
||||
}`
|
||||
) {
|
||||
vote
|
||||
recipGradidoID
|
||||
recipName
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const settleSendCoinsMutation = `
|
||||
mutation (
|
||||
@ -220,7 +225,11 @@ describe('SendCoinsResolver', () => {
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
voteForSendCoins: 'recipUser-FirstName recipUser-LastName',
|
||||
voteForSendCoins: {
|
||||
recipGradidoID: '56a55482-909e-46a4-bfa2-cd025e894ebd',
|
||||
recipName: 'recipUser-FirstName recipUser-LastName',
|
||||
vote: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
@ -19,7 +19,7 @@ import { SendCoinsResult } from '../model/SendCoinsResult'
|
||||
@Resolver()
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
export class SendCoinsResolver {
|
||||
@Mutation(() => String)
|
||||
@Mutation(() => SendCoinsResult)
|
||||
async voteForSendCoins(
|
||||
@Args()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user