mirror of
https://github.com/aleleba/create-node-ts-graphql-server.git
synced 2026-12-02 10:36:42 -06:00
Run check-updates and keep majors that are incompatible with type-graphql 2.0.0-rc.3 or the current tooling (typescript 6, graphql 16, graphql-scalars 1, Babel 7). Declare previously transitive imports (terser-webpack-plugin, globals, typescript-eslint, @eslint/js) as devDependencies so build and lint work again. Fix lint errors and update the versions listed in the README.
34 lines
670 B
TypeScript
34 lines
670 B
TypeScript
|
|
'use strict';
|
|
|
|
import { Query, Resolver, Mutation, FieldResolver, Arg } from 'type-graphql';
|
|
import { Test, TestMutation } from '@GraphQL/schema';
|
|
import { getTest, addText } from '@controllerGraphQL';
|
|
|
|
@Resolver(() => Test)
|
|
export class TestResolverQuery {
|
|
@Query(() => Test)
|
|
async test() {
|
|
return {};
|
|
}
|
|
|
|
@FieldResolver(() => String)
|
|
async text() {
|
|
return await getTest({});
|
|
}
|
|
}
|
|
|
|
@Resolver(() => TestMutation)
|
|
export class TestResolverMutation {
|
|
@Mutation(() => TestMutation)
|
|
async testMutation() {
|
|
return {};
|
|
}
|
|
|
|
@FieldResolver(() => String)
|
|
async text(@Arg('text') text?: string){
|
|
return await addText({text});
|
|
}
|
|
}
|
|
|