mirror of
https://github.com/aleleba/create-node-ts-graphql-server.git
synced 2025-07-01 02:08:27 -06:00
PR-442185: fixing the type graphql schema.
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user