PR-442185: fixing the type graphql schema.

This commit is contained in:
2023-03-14 00:15:33 +00:00
parent 28c1d501a0
commit 00a60519a2
7 changed files with 55 additions and 86 deletions

View File

@ -1,18 +1,19 @@
/* eslint-disable no-mixed-spaces-and-tabs */
'use strict';
import { Query, Resolver, Mutation, Arg } from 'type-graphql';
import { Query, Resolver, Mutation } from 'type-graphql';
import { Test, TestMutation } from '@GraphQL/schema/test.schema';
@Resolver(() => Test)
export class TestResolver {
@Query(() => Test)
async test() {
return {};
}
async test() {
return Test;
}
@Mutation(() => TestMutation)
async testMutation() {
return {};
return TestMutation;
}
}

View File

@ -1,36 +1,21 @@
/* eslint-disable no-mixed-spaces-and-tabs */
'use strict';
import { Field, ObjectType, Arg } from "type-graphql";
import { Field, ObjectType, Arg } from 'type-graphql';
import { getTest, addText } from '@controllerGraphQL';
@ObjectType()
export class Test {
@Field(() => Text)
async text(){
return {
text: await getTest({})
}
}
}
@ObjectType()
export class Text {
@Field()
text?: string
@Field(() => String)
async text(){
return await getTest({});
}
}
@ObjectType()
export class TestMutation {
@Field(type => TextMutation)
async textMutation(@Arg('text') text?: string){
return {
text: await addText({text})
}
}
}
@ObjectType()
export class TextMutation {
@Field()
text?: string
@Field(() => String)
async text(@Arg('text') text?: string){
return await addText({text});
}
}