mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
make bun compatible and also compatible with higher graphql version
This commit is contained in:
parent
273a0209da
commit
b3643209e4
14
federation/src/graphql/api/1_0/schema.ts
Normal file
14
federation/src/graphql/api/1_0/schema.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { NonEmptyArray } from 'type-graphql'
|
||||||
|
import { AuthenticationResolver } from './resolver/AuthenticationResolver'
|
||||||
|
import { PublicCommunityInfoResolver } from './resolver/PublicCommunityInfoResolver'
|
||||||
|
import { PublicKeyResolver } from './resolver/PublicKeyResolver'
|
||||||
|
import { SendCoinsResolver } from './resolver/SendCoinsResolver'
|
||||||
|
|
||||||
|
export const getApiResolvers = (): NonEmptyArray<Function> => {
|
||||||
|
return [
|
||||||
|
AuthenticationResolver,
|
||||||
|
PublicCommunityInfoResolver,
|
||||||
|
PublicKeyResolver,
|
||||||
|
SendCoinsResolver,
|
||||||
|
]
|
||||||
|
}
|
||||||
14
federation/src/graphql/api/1_1/schema.ts
Normal file
14
federation/src/graphql/api/1_1/schema.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { NonEmptyArray } from 'type-graphql'
|
||||||
|
import { AuthenticationResolver } from "../1_0/resolver/AuthenticationResolver"
|
||||||
|
import { PublicCommunityInfoResolver } from "../1_0/resolver/PublicCommunityInfoResolver"
|
||||||
|
import { SendCoinsResolver } from "../1_0/resolver/SendCoinsResolver"
|
||||||
|
import { PublicKeyResolver } from "./resolver/PublicKeyResolver"
|
||||||
|
|
||||||
|
export const getApiResolvers = (): NonEmptyArray<Function> => {
|
||||||
|
return [
|
||||||
|
AuthenticationResolver,
|
||||||
|
PublicCommunityInfoResolver,
|
||||||
|
PublicKeyResolver,
|
||||||
|
SendCoinsResolver,
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,9 +1,20 @@
|
|||||||
import path from 'node:path'
|
|
||||||
import { federationLogger as logger } from '@/server/logger'
|
import { federationLogger as logger } from '@/server/logger'
|
||||||
|
import { NonEmptyArray } from 'type-graphql'
|
||||||
// config
|
// config
|
||||||
import { CONFIG } from '../../config'
|
import { CONFIG } from '../../config'
|
||||||
|
import { getApiResolvers as getApiResolvers_1_0 } from './1_0/schema'
|
||||||
|
import { getApiResolvers as getApiResolvers_1_1 } from './1_1/schema'
|
||||||
|
|
||||||
export const getApiResolvers = (): string => {
|
export const getApiResolvers = (): NonEmptyArray<Function> => {
|
||||||
logger.info(`getApiResolvers...${CONFIG.FEDERATION_API}`)
|
logger.info(`getApiResolvers...${CONFIG.FEDERATION_API}`)
|
||||||
return path.join(__dirname, `./${CONFIG.FEDERATION_API}/resolver/*Resolver.{ts,js}`)
|
|
||||||
|
if (CONFIG.FEDERATION_API === '1_0') {
|
||||||
|
return getApiResolvers_1_0()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CONFIG.FEDERATION_API === '1_1') {
|
||||||
|
return getApiResolvers_1_1()
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Unknown API version: ${CONFIG.FEDERATION_API}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { DecimalScalar } from './scalar/Decimal'
|
|||||||
|
|
||||||
export const schema = async (): Promise<GraphQLSchema> => {
|
export const schema = async (): Promise<GraphQLSchema> => {
|
||||||
return await buildSchema({
|
return await buildSchema({
|
||||||
resolvers: [getApiResolvers()],
|
resolvers: getApiResolvers(),
|
||||||
// authChecker: isAuthorized,
|
// authChecker: isAuthorized,
|
||||||
scalarsMap: [{ type: Decimal, scalar: DecimalScalar }],
|
scalarsMap: [{ type: Decimal, scalar: DecimalScalar }],
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user