i create mutation like following
@Mutation(returns => TagTranslation)
updateTagTranslationName(@Arg('id') id: number, @Arg('name') name: string): Promise<TagTranslation>{
return this.tagTranslationService.findById(id);
and in the playgrond, i send like following
mutation {
updateTagTranslationName(id:1, name:"123") {
code
}
}
but it returns error "message": "Cannot return null for non-nullable field Mutation.updateTagTranslationName.", "locations": [ { "line": 2, "column": 3 } ], "path": [ "updateTagTranslationName" ],
following is my tagtranslation entity
@Table({
tableName: 'tag_translation',
indexes: [
]
})
@ObjectType()
export class TagTranslation extends Model<TagTranslation>{
@PrimaryKey
@AutoIncrement
@Column
@Field(type => Int)
id: number;
@ForeignKey(()=> Tag)
@Field()
@Column
tag_id: number;
@Column
@Field({ nullable: true })
name: string;
@Column
@Field({ nullable: true })
language: string;
}
and following is error message
{
"errors": [
{
"message": "Cannot return null for non-nullable field Mutation.updateTagTranslationName.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"updateTagTranslationName"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: Cannot return null for non-nullable field Mutation.updateTagTranslationName.",
" at completeValue
I don't know why it returns error. please help me....