mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-01 12:44:43 +00:00
create graphql endpoint for GetPublicKey request
This commit is contained in:
parent
a05c2307ee
commit
4e1a6d965e
11
federation/src/graphql/api/1_0/model/GetPublicKeyResult.ts
Normal file
11
federation/src/graphql/api/1_0/model/GetPublicKeyResult.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { Field, ObjectType } from 'type-graphql'
|
||||
|
||||
@ObjectType()
|
||||
export class GetPublicKeyResult {
|
||||
constructor(pubKey: string) {
|
||||
this.publicKey = pubKey
|
||||
}
|
||||
|
||||
@Field(() => String)
|
||||
publicKey: string
|
||||
}
|
||||
18
federation/src/graphql/api/1_0/resolver/PublicKeyResolver.ts
Normal file
18
federation/src/graphql/api/1_0/resolver/PublicKeyResolver.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Field, ObjectType, Query, Resolver } from 'type-graphql'
|
||||
import { federationLogger as logger } from '@/server/logger'
|
||||
import { Community as DbCommunity } from '@entity/Community'
|
||||
import { GetPublicKeyResult } from '../model/GetPublicKeyResult'
|
||||
|
||||
@Resolver()
|
||||
export class PublicKeyResolver {
|
||||
@Query(() => GetPublicKeyResult)
|
||||
async getPublicKey(): Promise<GetPublicKeyResult> {
|
||||
logger.info(`getPublicKey()...`)
|
||||
const homeCom = await DbCommunity.findOneOrFail({
|
||||
foreign: false,
|
||||
apiVersion: '1_0',
|
||||
})
|
||||
logger.info(`getPublicKey()... with publicKey=${homeCom.publicKey}`)
|
||||
return new GetPublicKeyResult(homeCom.publicKey.toString())
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
import { Field, ObjectType } from 'type-graphql'
|
||||
|
||||
@ObjectType()
|
||||
export class GetTestApiResult {
|
||||
constructor(apiVersion: string) {
|
||||
this.api = apiVersion
|
||||
}
|
||||
|
||||
@Field(() => String)
|
||||
api: string
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user