Ошибка mutation в type-graphql
Доброй ночи, вышибает ошибку когда хочу создать resolver с @Mutation, не могу понять почему. Если поставить @Query, то проблема решается, но нужна мутация
Error
(node:15840) UnhandledPromiseRejectionWarning: Error: Type Query must define one or more fields.
Resolver
import { Arg, Field, Mutation, ObjectType, Resolver } from "type-graphql";
import { getManager } from "typeorm";
import User from "../../entity/User";
@ObjectType()
export class GeneralOutputType {
@Field(() => String)
id!: string
}
@Resolver()
export class UserResolver {
@Mutation(() => GeneralOutputType, {nullable: true})
async create (
@Arg('id') id: string,
): Promise<GeneralOutputType> {
const user = new User();
user.name = 'sds';
user.username = 'sds';
user.email = 'sds';
user.password = 'sds';
user.biography = 'sds';
await getManager().save(user);
return {id}
}
}
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
"sourceMap": true,
"outDir": "build",
"moduleResolution": "node",
"declaration": false,
"composite": false,
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"baseUrl": ".",
"rootDir": "src"
}
}
Если нужна будет, какая то еще информация, пишите. Заранее спасибо.