mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fixes based on the unit tests
This commit is contained in:
parent
3391b3a9ee
commit
827c829306
@ -1,7 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const adminCreateContributionMessage = gql`
|
||||
mutation ($contributionId: Float!, $message: String!) {
|
||||
mutation ($contributionId: Int!, $message: String!) {
|
||||
adminCreateContributionMessage(contributionId: $contributionId, message: $message) {
|
||||
id
|
||||
message
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export const listContributionMessages = gql`
|
||||
query ($contributionId: Float!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) {
|
||||
query ($contributionId: Int!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) {
|
||||
listContributionMessages(
|
||||
contributionId: $contributionId
|
||||
pageSize: $pageSize
|
||||
|
||||
@ -154,7 +154,8 @@ describe('validate Communities', () => {
|
||||
})
|
||||
it('logs unsupported api for community with api 2_0 ', () => {
|
||||
expect(logger.warn).toBeCalledWith(
|
||||
`Federation: dbCom: ${dbCom.id} with unsupported apiVersion=2_0; supported versions=1_0,1_1`,
|
||||
`Federation: dbCom: ${dbCom.id} with unsupported apiVersion=2_0; supported versions`,
|
||||
['1_0', '1_1'],
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { ArgsType, Field, ID, InputType } from 'type-graphql'
|
||||
import { ArgsType, Field, Int, InputType } from 'type-graphql'
|
||||
|
||||
@InputType()
|
||||
@ArgsType()
|
||||
export default class ContributionMessageArgs {
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
contributionId: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { ObjectType, Field, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
|
||||
@ObjectType()
|
||||
export class Community {
|
||||
@ -16,7 +16,7 @@ export class Community {
|
||||
}
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Contribution as dbContribution } from '@entity/Contribution'
|
||||
import { User } from '@entity/User'
|
||||
@ -23,7 +23,7 @@ export class Contribution {
|
||||
this.deletedBy = contribution.deletedBy
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@ -44,13 +44,13 @@ export class Contribution {
|
||||
@Field(() => Date, { nullable: true })
|
||||
confirmedAt: Date | null
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
confirmedBy: number | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
deniedAt: Date | null
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
deniedBy: number | null
|
||||
|
||||
@Field(() => Date, { nullable: true })
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { ContributionLink as dbContributionLink } from '@entity/ContributionLink'
|
||||
import CONFIG from '@/config'
|
||||
@ -21,7 +21,7 @@ export class ContributionLink {
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_CONTRIBUTION_URL.replace(/{code}/g, this.code)
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => Decimal)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Field, ID, Int, ObjectType } from 'type-graphql'
|
||||
import { Field, Int, ObjectType } from 'type-graphql'
|
||||
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
||||
import { User } from '@entity/User'
|
||||
|
||||
@ -16,7 +16,7 @@ export class ContributionMessage {
|
||||
this.isModerator = contributionMessage.isModerator
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -37,7 +37,7 @@ export class ContributionMessage {
|
||||
@Field(() => String, { nullable: true })
|
||||
userLastName: string | null
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
userId: number | null
|
||||
|
||||
@Field(() => Boolean)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
import { ObjectType, Field, Float, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Float, Int } from 'type-graphql'
|
||||
import { GdtEntryType } from '@enum/GdtEntryType'
|
||||
|
||||
@ObjectType()
|
||||
@ -21,7 +21,7 @@ export class GdtEntry {
|
||||
this.gdt = json.gdt
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => Float)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { Decay } from './Decay'
|
||||
import { Transaction as dbTransaction } from '@entity/Transaction'
|
||||
import Decimal from 'decimal.js-light'
|
||||
@ -47,13 +47,13 @@ export class Transaction {
|
||||
: transaction.transactionLinkId || null
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => User)
|
||||
user: User
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
previous: number | null
|
||||
|
||||
@Field(() => TransactionTypeId)
|
||||
@ -80,10 +80,10 @@ export class Transaction {
|
||||
@Field(() => User, { nullable: true })
|
||||
linkedUser: User | null
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
linkedTransactionId: number | null
|
||||
|
||||
// Links to the TransactionLink/ContributionLink when transaction was created by a link
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
linkId: number | null
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { TransactionLink as dbTransactionLink } from '@entity/TransactionLink'
|
||||
import { User } from './User'
|
||||
@ -21,7 +21,7 @@ export class TransactionLink {
|
||||
this.link = CONFIG.COMMUNITY_REDEEM_URL.replace(/{code}/g, this.code)
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => User)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { Contribution } from '@entity/Contribution'
|
||||
import { User } from '@entity/User'
|
||||
@ -29,7 +29,7 @@ export class UnconfirmedContribution {
|
||||
@Field(() => String)
|
||||
lastName: string
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
userId: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -44,7 +44,7 @@ export class UnconfirmedContribution {
|
||||
@Field(() => Decimal)
|
||||
amount: Decimal
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
moderator: number | null
|
||||
|
||||
@Field(() => [Decimal])
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, ID, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { KlickTipp } from './KlickTipp'
|
||||
import { User as dbUser } from '@entity/User'
|
||||
import { UserContact } from './UserContact'
|
||||
@ -28,7 +28,7 @@ export class User {
|
||||
this.hideAmountGDT = user.hideAmountGDT
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
@ -37,7 +37,7 @@ export class User {
|
||||
@Field(() => String, { nullable: true })
|
||||
alias: string | null
|
||||
|
||||
@Field(() => ID, { nullable: true })
|
||||
@Field(() => Int, { nullable: true })
|
||||
emailId: number | null
|
||||
|
||||
// TODO privacy issue here
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, Int, ID } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import Decimal from 'decimal.js-light'
|
||||
import { User } from '@entity/User'
|
||||
|
||||
@ -17,7 +17,7 @@ export class UserAdmin {
|
||||
this.isAdmin = user.isAdmin
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
userId: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ObjectType, Field, ID, Int } from 'type-graphql'
|
||||
import { ObjectType, Field, Int } from 'type-graphql'
|
||||
import { UserContact as dbUserContact } from '@entity/UserContact'
|
||||
|
||||
@ObjectType()
|
||||
@ -18,13 +18,13 @@ export class UserContact {
|
||||
this.deletedAt = userContact.deletedAt
|
||||
}
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
id: number
|
||||
|
||||
@Field(() => String)
|
||||
type: string
|
||||
|
||||
@Field(() => ID)
|
||||
@Field(() => Int)
|
||||
userId: number
|
||||
|
||||
@Field(() => String)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Arg, Args, Authorized, Ctx, ID, Mutation, Query, Resolver } from 'type-graphql'
|
||||
import { Arg, Args, Authorized, Ctx, Int, Mutation, Query, Resolver } from 'type-graphql'
|
||||
import { getConnection } from '@dbTools/typeorm'
|
||||
|
||||
import { ContributionMessage as DbContributionMessage } from '@entity/ContributionMessage'
|
||||
@ -69,7 +69,7 @@ export class ContributionMessageResolver {
|
||||
@Authorized([RIGHTS.LIST_ALL_CONTRIBUTION_MESSAGES])
|
||||
@Query(() => ContributionMessageListResult)
|
||||
async listContributionMessages(
|
||||
@Arg('contributionId', () => ID) contributionId: number,
|
||||
@Arg('contributionId', () => Int) contributionId: number,
|
||||
@Args()
|
||||
{ currentPage = 1, pageSize = 5, order = Order.DESC }: Paginated,
|
||||
): Promise<ContributionMessageListResult> {
|
||||
|
||||
@ -2024,7 +2024,7 @@ describe('ContributionResolver', () => {
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
adminCreateContribution: [1000, 1000, 590],
|
||||
adminCreateContribution: ['1000', '1000', '590'],
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
@ -328,7 +328,7 @@ describe('send coins', () => {
|
||||
).toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
sendCoins: 'true',
|
||||
sendCoins: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
@ -383,7 +383,7 @@ describe('send coins', () => {
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
sendCoins: 'true',
|
||||
sendCoins: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
@ -399,7 +399,7 @@ describe('send coins', () => {
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
sendCoins: 'true',
|
||||
sendCoins: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
@ -415,7 +415,7 @@ describe('send coins', () => {
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
sendCoins: 'true',
|
||||
sendCoins: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
@ -431,7 +431,7 @@ describe('send coins', () => {
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
sendCoins: 'true',
|
||||
sendCoins: true,
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
@ -288,7 +288,7 @@ describe('UserResolver', () => {
|
||||
})
|
||||
|
||||
describe('no publisher id', () => {
|
||||
it('sets publisher id to null', async () => {
|
||||
it('sets publisher id to 0', async () => {
|
||||
await mutate({
|
||||
mutation: createUser,
|
||||
variables: { ...variables, email: 'raeuber@hotzenplotz.de', publisherId: undefined },
|
||||
@ -299,7 +299,7 @@ describe('UserResolver', () => {
|
||||
emailContact: expect.objectContaining({
|
||||
email: 'raeuber@hotzenplotz.de',
|
||||
}),
|
||||
publisherId: null,
|
||||
publisherId: 0,
|
||||
}),
|
||||
]),
|
||||
)
|
||||
@ -854,7 +854,7 @@ describe('UserResolver', () => {
|
||||
it('returns true', async () => {
|
||||
await expect(mutate({ mutation: logout })).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
data: { logout: 'true' },
|
||||
data: { logout: true },
|
||||
errors: undefined,
|
||||
}),
|
||||
)
|
||||
|
||||
@ -269,7 +269,7 @@ export const denyContribution = gql`
|
||||
`
|
||||
|
||||
export const createContributionMessage = gql`
|
||||
mutation ($contributionId: Float!, $message: String!) {
|
||||
mutation ($contributionId: Int!, $message: String!) {
|
||||
createContributionMessage(contributionId: $contributionId, message: $message) {
|
||||
id
|
||||
message
|
||||
@ -283,7 +283,7 @@ export const createContributionMessage = gql`
|
||||
`
|
||||
|
||||
export const adminCreateContributionMessage = gql`
|
||||
mutation ($contributionId: Float!, $message: String!) {
|
||||
mutation ($contributionId: Int!, $message: String!) {
|
||||
adminCreateContributionMessage(contributionId: $contributionId, message: $message) {
|
||||
id
|
||||
message
|
||||
|
||||
@ -301,7 +301,7 @@ export const searchAdminUsers = gql`
|
||||
`
|
||||
|
||||
export const listContributionMessages = gql`
|
||||
query ($contributionId: Float!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) {
|
||||
query ($contributionId: Int!, $pageSize: Int = 25, $currentPage: Int = 1, $order: Order = ASC) {
|
||||
listContributionMessages(
|
||||
contributionId: $contributionId
|
||||
pageSize: $pageSize
|
||||
|
||||
@ -128,7 +128,7 @@ export const deleteContribution = gql`
|
||||
`
|
||||
|
||||
export const createContributionMessage = gql`
|
||||
mutation($contributionId: Float!, $message: String!) {
|
||||
mutation($contributionId: Int!, $message: String!) {
|
||||
createContributionMessage(contributionId: $contributionId, message: $message) {
|
||||
id
|
||||
message
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user