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> => {
|
voteForSendCoins = async (args: SendCoinsArgs): Promise<SendCoinsResult> => {
|
||||||
logger.debug('X-Com: voteForSendCoins against endpoint=', this.endpoint)
|
logger.debug('X-Com: voteForSendCoins against endpoint=', this.endpoint)
|
||||||
try {
|
try {
|
||||||
|
logger.debug(`SendCoinsClient: voteForSendCoins with args=`, args)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
const { data } = await this.client.rawRequest(voteForSendCoins, { args })
|
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
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||||
if (!data?.voteForSendCoins?.vote) {
|
if (!sendCoinsResult.vote) {
|
||||||
logger.warn(
|
logger.warn(
|
||||||
'X-Com: voteForSendCoins failed with: ',
|
'X-Com: voteForSendCoins failed with: ',
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
// 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
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||||
data.voteForSendCoins.recipName,
|
sendCoinsResult.recipName,
|
||||||
)
|
)
|
||||||
return new SendCoinsResult()
|
return sendCoinsResult
|
||||||
}
|
}
|
||||||
const result = new SendCoinsResult()
|
const result = new SendCoinsResult()
|
||||||
result.vote = true
|
result.vote = true
|
||||||
|
|||||||
@ -121,7 +121,7 @@ export async function processXComPendingSendCoins(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`Error:`, err)
|
throw new LogError(`Error:`, err)
|
||||||
}
|
}
|
||||||
return sendCoinsResult
|
return sendCoinsResult
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { ArgsType, Field } from 'type-graphql'
|
import { Field, ObjectType } from 'type-graphql'
|
||||||
|
|
||||||
@ArgsType()
|
@ObjectType()
|
||||||
export class SendCoinsResult {
|
export class SendCoinsResult {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.vote = false
|
this.vote = false
|
||||||
@ -9,9 +9,9 @@ export class SendCoinsResult {
|
|||||||
@Field(() => Boolean)
|
@Field(() => Boolean)
|
||||||
vote: boolean
|
vote: boolean
|
||||||
|
|
||||||
@Field(() => String, { nullable: true })
|
@Field(() => String)
|
||||||
recipGradidoID: string | null
|
recipGradidoID: string | null
|
||||||
|
|
||||||
@Field(() => String, { nullable: true })
|
@Field(() => String)
|
||||||
recipName: string | null
|
recipName: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,8 +68,13 @@ describe('SendCoinsResolver', () => {
|
|||||||
senderCommunityUuid: $senderCommunityUuid
|
senderCommunityUuid: $senderCommunityUuid
|
||||||
senderUserUuid: $senderUserUuid
|
senderUserUuid: $senderUserUuid
|
||||||
senderUserName: $senderUserName
|
senderUserName: $senderUserName
|
||||||
)
|
) {
|
||||||
}`
|
vote
|
||||||
|
recipGradidoID
|
||||||
|
recipName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
const settleSendCoinsMutation = `
|
const settleSendCoinsMutation = `
|
||||||
mutation (
|
mutation (
|
||||||
@ -220,7 +225,11 @@ describe('SendCoinsResolver', () => {
|
|||||||
).toEqual(
|
).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: {
|
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()
|
@Resolver()
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
export class SendCoinsResolver {
|
export class SendCoinsResolver {
|
||||||
@Mutation(() => String)
|
@Mutation(() => SendCoinsResult)
|
||||||
async voteForSendCoins(
|
async voteForSendCoins(
|
||||||
@Args()
|
@Args()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user